安装mysql
yum install -y mariadb-server
开机自启动
systemctl enable mariadb.service
修改配置文件
vim /etc/my.cnf
character-set-server=utf8
port=3306
启动mysql
systemctl start mariadb.service
修改root密码
mysqladmin -u root password '123456'
登录mysql
mysql -uroot -p123456
修改root访问权限
use mysql;
update user set Host='%' where User='root' and Host="localhost";
flush privileges
停止mysql
systemctl stop mariadb
启动服务:systemctl start xxx.service
关闭服务:systemctl stop xxx.service
重启服务:systemctl restart xxx.service
显示服务的状态:systemctl status xxx.service
在开机时启用服务:systemctl enable xxx.service
在开机时禁用服务:systemctl disable xxx.service
查看服务是否开机启动:systemctl is-enabled xxx.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed