安装:
1、下载安装包;https://mariadb.org/download/ mariadb 10.2 对应 mysql 5.7
2、查看官网二进制安装教程:https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/ 注意提前配置好/etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd innodb_file_per_table=ON [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d
/etc/my.cnf.d 只有一个文件 mysql-clients.cnf
# # These groups are read by MariaDB command-line tools # Use it for options that affect only one utility # [mysql] socket=/var/lib/mysql/mysql.sock [mysql_upgrade] [mysqladmin] [mysqlbinlog] [mysqlcheck] [mysqldump] [mysqlimport] [mysqlshow] [mysqlslap]
运行安装脚本的时候注意:1、禁用主机名解析;2、安装完成之后注意运行安全脚本,进行相关操作;
3、设置密码登录,安装完成之后,本机不需要输入密码即可登录,即使已经运行了安全脚本设置了root账户的密码;
MariaDB [mysql]> SELECT PASSWORD('root'); +-------------------------------------------+ | PASSWORD('root') | +-------------------------------------------+ | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | +-------------------------------------------+ 1 row in set (0.00 sec) MariaDB [mysql]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B'; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec)
安装完成