ArchLinux安装配置mariadb

1.安装mariadb包.

sudo pacman -S mariadb

2.运行初始化脚本mysql_install_db

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
......
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
......

3.启动mysql.

sudo systemctl start mysql

4.设置root用户密码.

sudo mysql
set password for root@localhost = password('新密码');
exit;
#
mysql -uroot -p新密码  #使用密码登入root用户方法

 ps: 可以通过修改/etc/my.cnf.d/server.cnf配置文件bind-address=127.0.0.1设置mysql只用于本机访问。

posted @ 2020-12-09 19:39  fatalord  阅读(1308)  评论(0编辑  收藏  举报