CentOS7安装MariaDB MariaDB简介 官网:https://mariadb.org/
MariaDB Github地址:https://github.com/MariaDB/server
安装MariaDB 1 2 3 4 su root yum -y install mariadb-server mariadb yum -y install mariadb-server mariadb systemctl enable mariadb
测试是否成功 1 2 3 4 5 6 7 8 [root@localhost toor] Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.56-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help . Type '\c' to clear the current input statement.
运行一次mysql_secure_installation安全配置向导 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Enter current password for root (enter for none): OK, successfully used password, moving on... Set root password? [Y/n] y New password: Re-enter new password: Remove anonymous users ? [Y/n] y ... Success! Disallow root login remotely? [Y/n] n ... skipping. Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y ... Success!
开放端口 1 2 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload
开放远程连接
1 2 3 4 5 6 mysql> grant all privileges on *.* to 'root' @'%' identified by '123456' ; mysql> flush privileges; mysql> exit
修改编码为UTF-8
添加以下内容:
1 2 [mysqld] character-set-server=utf8
需要重启数据库
1 2 3 4 mysql -uroot -p show variables like 'character%' ;
结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 MariaDB [(none)]> show variables like 'character%' ; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
使用mysql workbench连接
参考:
Centos7 安装配置MariaDB