centos 安装mariadb 替代mysql

时间:2021-08-29 04:27:06

yum install mariadb-server mariadb
systemctl start mariadb
mysql -uroot -p
默认密码
mysql -uroot -p
mysql_secure_installation  初始化设置  



//允许用户testuser从ip为222.129.1.1的主机连接到mysql服务器,并使用testpassword作为密码 MariaDB [(none)]> grant all privileges on *.* to ‘testuser‘@‘222.129.1.1‘ identified by ‘testpassword‘ with grant option; (若是允许所有ip:GRANT ALL PRIVILEGES ON *.* TO ‘testuser’@‘%’ IDENTIFIED BY ‘testpassword’ WITH GRANT OPTION;) MariaDB [(none)]> flush privileges; //刷新权限缓存 MariaDB [(none)]> show privileges; MariaDB [(none)]> show grants for ‘testuser‘@‘222.129.1.1


systemctl restart mariadb