1 centeos7安装mariadb
yum -y install mariadb mariadb-server
2 启动mariadb服务
systemctl start mariadb.service
systemctl enable mariadb.service
3 配置
执行mysql_secure_installation
1首先提示输入密码:
Enter current password for root (enter for none):<–初次运行直接回车
2设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
配置完成后,执行mysql -uroot -ppassword测试登录。其中root为要登录的用户名,password为刚才设置的root用户的密码
如果需要开启root的远程登录用于实验等环境则首先ssh进入数据库
mysql -uroot -ppassword
use mysql;
select host,user,password from user;<-查看表中有没有一条这样的记录
如果有上述记录直接
update user set host=‘%‘ where host=‘::1‘;
flush privileges;
即可打开root远程登录(不适用生产环境)
如果没有上述记录则执行
grant all privileges on *.* to root@‘%‘ identified by "password";
flush privileges;
centeos7安装mariadb
原文:https://www.cnblogs.com/WaterGe/p/11257382.html