前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >在ArchLinux中安装MySql

在ArchLinux中安装MySql

作者头像
乐百川
发布2022-05-05 19:18:24
1.2K0
发布2022-05-05 19:18:24
举报

最近在用ArchLinux在虚拟机里学习Linux。现在想在ArchLinux中安装WordPress,首先就需要安装MySql数据库。但是在MySql被Oracle收购之后,很多开源支持者就转而使用MariaDb了。不过MariaDb也和MySql兼容的,所以基本不用有什么担心。由于ArchLinux只带了MariaDb,所以我们就用MariaDb来代替MySql。

安装MariaDb和其客户端工具,

代码语言:javascript
复制
sudo pacman -S mariadb mariadb-clients

安装完成之后,会出现如何开启MariaDb的提示:

:: You need to initialize the MariaDB data directory prior to starting the service. This can be done with mysql_install_db command, e.g.: mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql

根据提示,我们运行如下命令就可以初始化MariaDb的数据目录了。

代码语言:javascript
复制
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

在经过一长串提示信息之后,就会出现相应的如何开启MariaDb的帮助信息:

代码语言:javascript
复制
 To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h mypc password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at sales@mariadb.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

同样根据提示,我们首先需要先启动MariaDb,

代码语言:javascript
复制
sudo systemctl start mysqld

然后为root用户设置一个新密码,

代码语言:javascript
复制
mysqladmin -u root password '12345678' 

然后尝试登录MariaDb,如果登录成功,说明配置完成了,

代码语言:javascript
复制
mysql -uroot -p 12345678

如果想要MariaDb开机自动启动,那么就运行以下命令,

代码语言:javascript
复制
sudo systemctl enable mysqld
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-11-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档