当前位置:Gxlcms > 数据库问题 > Centos下安装Mysql5.7

Centos下安装Mysql5.7

时间:2021-07-01 10:21:17 帮助过:24人阅读

-y update

卸载已安装的Mysql

yum -y remove mysql-libs

安装依赖

yum -y install numactl-libs

下载安装包

wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.19-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.19-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.19-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.19-1.el7.x86_64.rpm

安装

rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm --nosignature
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm --nosignature
rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm --nosignature
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm --nosignature
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm --nosignature

启动

service mysqld start

查看初始密码

grep "password" /var/log/mysqld.log

登录mysql后立即修改密码

SET PASSWORD FOR root@localhost = PASSWORD(newpass);

此处可能提示密码不符合要求,输入下列语句后重新修改密码即可

set global validate_password_policy=0;

设置开机自启

chkconfig mysqld on

修改mysql配置

vim /etc/my.cnf

修改为

[client]
port=3306
default-character-set=utf8mb4
[mysqld]
port=3306
character-set-client-handshake=0
character_set_server=utf8mb4
collation-server=utf8mb4_unicode_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Centos下安装Mysql5.7

标签:unicode   mys   policy   com   完成   down   comm   set   get   

人气教程排行