第一步: 使用命令查看是否已经安装:
mysql -u root -p
返回 Enter password: 时表示已经安装成功的,需要卸载安装.
第二步: 使用yum直接安装mariadb,注意带*号所有:
yum -y install mariadb*
第三步: 启动mariadb:
systemctl start mysqld.service
第四步: 登录Mysql,输入任意密码,进入use mysql,更新初始密码:
mysql -u root -p
use mysql;
update user set password=password('heyouhao') where user='root';
第五步: 需要远程登录修改host,并刷新mysql的系统权限相关表:
update user set host='%' where host='localhost';
flush privileges;
exit;
第六步: 重启mysql服务并测试.
mysql服务:
systemctl start mysqld.service #启动Mysql
systemctl stop mysqld.service #停止Mysql
systemctl restart mysqld.service #重启Mysql
systemctl enable mysqld.service #设置开机启动
systemctl restart mariadb.service #重启mariadb