1、安装MariaDB:
sudo pacman -S mariadb libmariadbclient mariadb-clients //安装mariadb
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql //初始化数据
2. 启动mariadb
systemctl start mariadb //开启mysql服务
systemctl stop mysqld //停止mysql服务
mysql_secure_installation //设置密码等管理操作
systemctl restart mariadb //重启mysql服务
3、root登录:
mysql -u root -p
输入刚刚设置的密码即可登陆
出现的小问题记录:
1、执行systemctl start mariadb命令时,出现Invalid unit name "mariadb " escaped as "mariadb\xe3\x80\x80" (maybe you should use systemd-escape?).
Failed to start mariadb\xe3\x80\x80.service: Unit mariadb\xe3\x80\x80.service not found.
解决方法:根据百度上的方法,卸载重装,亲试有效
2、执行mysql_secure_installation 命令时,出现Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
解决办法:执行systemctl start mariadb命令再次启动。
参考文章:https://www.cnblogs.com/guochaoxxl/p/14026666.html