Mysql
1.添加Mysql源
sudo yum install -y http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
yum repolist
2.安装Mysql
yum install mysql-community-server
3.初始化 MySQL
systemctl start mysqld
mysql_secure_installation
4.添加用户
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO mintcode@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
5.防火墙
firewall-cmd --permanent --add-port=3306/tcp
systemctl restart firewalld
firewall-cmd --list-all
7.设置Mysql数据库(主要是表情)
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
8.启用事件
[mysqld]
event_scheduler = 1
9.检查
For each database:
ALTER DATABASE dianna CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
For each table:
ALTER TABLE message CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
For each column:
ALTER TABLE message CHANGE Content Content text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
(Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a VARCHAR
column.)
SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
网友评论