**卸载** yum remove mariadb* 配置添加yum源文件 vim /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://archive.mariadb.org/mariadb-10.0.10/yum/centos6-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck= 0 其他版本请参照官网修改版本号 MariaDB 10.0 CentOS repository list - created 2016-05-30 02:16 UTC http://downloads.mariadb.org/mariadb/repositories/ **查配置yum源对应的mariadb版本是否正确** yum makecache yum info MariaDB-server 安装MariaDB-server和Client yum install MariaDB-server MariaDB-client MariaDB-devel -y 注:如果有提示和以前安装的版本冲突,您可能需要先移除以前安装的包,例如: yum remove mariadb-libs. 新建数据目录并创建mysql用户 mkdir -p /data/dbdata/data/ && useradd mysql -s /sbin/nologin **初始化数据库目录** mysql_install_db --datadir='/data/dbdata/data/' 或者 mysql_install_db --defaults-file=/etc/mariadb/etc/my.cnf **修改权限并手工命令启动** chown mysql:mysl /data/dbdata/data/ -R cd '/usr' ; /usr/bin/mysqld_safe --datadir='/data/dbdata/data/' & 或者 mysqld_safe --defaults-file=/etc/mariadb/etc/my.cnf & **初始化数据库权限** mysql_secure_installation --defaults-file=/etc/mariadb/etc/my.cnf 或者 mysql -h 127.0.0.1 -uroot -p -P3307 grant all privileges on *.* to 'root'@'localhost' identified by 'password'; grant all privileges on *.* to 'root'@'127.0.0.1' identified by 'password'; flush privileges https://blog.csdn.net/weixin_42914965/article/details/92588793