1.安装MariaDB
删除已安装的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安装10.3版本的mariadb:
vi /etc/yum.repos.d/MariaDB.repo[mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.3/centos7-amd64gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=1或者使用阿里云的源[mariadb]name = MariaDBbaseurl = http://mirrors.aliyun.com/mariadb/yum/10.3/centos7-amd64/gpgkey = http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDBgpgcheck = 1安装命令yum -y install MariaDB-server MariaDB-client 2.进行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 -ppassworddone!