1.在CentOS上安装Mariadb
使用yum安装mariadb mariadb-devel mariadb-server
1
sudo yum install -y mariadb mariadb-devel mariadb-server
2.启动服务
启动服务的同时设置开机自动启动
1
2
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
3.设置密码
初次登陆mysql是没有密码的,输入下面的命令在输入密码的地方继续回车即可
1
mysql -uroot -p
4.配置权限
接下来要设置root用户的密码,并赋予相应权限
1
2
3
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;