sudo yum -y install mariadb-server
systemctl start mariadb
Enter current password for root (enter for none):
让我们输入root用户密码,初次运行直接回车。
Set root password? [Y/n]
是否设置root用户密码,输入y并回车或直接回车。
New password:
Re-enter new password:
输入新密码,并确认密码。
Remove anonymous users? [Y/n] 是否删除匿名用户,输入y或者回车。
Disallow root login remotely? [Y/n] 是否禁止root远程登录,输入y或者回车。
Remove test database and access to it? [Y/n] 是否删除test数据库,输入y或者回车。
Reload privilege tables now? [Y/n] 是否重新加载权限表,输入y或者回车。
启动mairadb服务后,登入就可以看到mariadb的版本号了。
mysql -u root -p
密码 root
1为需要远程的用户赋予权限
新建用户远程连接mysql数据库:
grant all on *.* to admin@'%' identified by 'yourpassword' with grant option;
刷新权限
flush privileges;
账号 admin
密码 yourpassword
远程登陆即可