2019独角兽企业重金招聘Python工程师标准>>>
-
下载mysql的源
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
-
安装yum库
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
-
安装MySQL
yum install -y mysql-community-server
-
启动MySQL服务
systemctl start mysqld.service
-
MySQL5.7加强了root用户的安全性,因此在第一次安装后会初始化一个随机密码,以下为查看初始随机密码的方式
grep 'temporary password' /var/log/mysqld.log
登录mysql mysql -u root -pSET PASSWORD = PASSWORD('你的密码');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
然后退出后即可用新密码登录。
远程连接授权:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;systemctl start mysqld.service
systemctl stop mysqld.service
systemctl restart mysqld.service
systemctl enable mysqld.servicesystemctl start mariadb.service支持表情数据库
[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'