环境搭建-Mariadb的安装(Linux)
删除存在的mysql
yum remove mysql mysql-server mysql-libs mysql-devel
删除存放数据的目录
rm -rf /var/lib/mysql
安装mariadb
yum -y install mariadb mariadb-server
启动mariadb
systemctl start mariadb
设置开机自启动
systemctl enable mariadb
定义阿里云的源
vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安装
yum -y install MariaDB-server MariaDB-client
配置Mariadb
设置密码
mysql_secure_installation
Enter current password for root (enter for none):<–初次运行直接回车
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] <– 是否重新加载权限表,回车
Thanks for using MariaDB!
登录mariadb
mysql -uroot -p
MariaDB [(none)]>use mysql;
Database changed
MariaDB [mysql]> quit
Bye
[root@katyhudson ~]#
【部分内容整理自网络 侵删联系】