环境背景:CentOS 7.2
一、编辑/usr/lib/systemd/system/mariadb.service 文件,在Service段中添加 |
1 2 3 4 5 6 7 8 9 10 11 12 |
|
二、键入systemctl daemon-reload使其立即生效 |
1 |
|
三、重新启动mariadb服务并使用mysql联入 |
1 2 3 4 5 6 7 8 9 10 11 |
|
四、更改root用户的密码 |
1 2 3 4 5 6 |
|
五、退出并关闭mariadb服务并把/usr/lib/systemd/system/mariadb.service文件中刚刚添加的那两行移除 |
1 2 |
|
六、启动mariadb服务,并使用新设置的密码连接 |
1 2 3 4 5 6 7 8 9 10 11 |
|
参考:http://dashui.blog.51cto.com/11254923/1877042