sudo pacman -S mysql
#初始化
sudo mysqld --initialize --user=mysql
#完成后会生成一个临时的密码,记住
#如果提示文件夹被占用,就删除
sudo rm -rf /var/lib/mysql
sudo systemctl start mysqld
mysql -u root -p
#这里会提示输入临时密码
5. 修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-password';
$ mysql -u root -p
mysql> use mysql
mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY '你的密码';
mysql> FLUSH PRIVILEGES;