CentOS7 yum方式安装MySQL5.7
-
下载并安装MySQL官方的 Yum Repository
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm yum localinstall mysql57-community-release-el7-8.noarch.rpm -y yum install mysql-community-server mysql -y 复制代码 -
MySql初始化及配置
-
启动:
systemctl start mysqld -
查看状态:
systemctl status mysqld -
查看初始密码:
grep "password" /var/log/mysqld.log
-
登录: mysql -uroot -p'查到的密码'
-
这个两个设置以后 密码很简单不会报错
set global validate_password_policy=0; set global validate_password_length=1; 复制代码 -
修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; -
启用远程连接:
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; -
刷新权限: flush privileges;
-
修改默认字符集: vi /etc/my.cnf
[mysqld] default-storage-engine=INNODB character-set-server = utf8mb4 collation-server = utf8mb4_general_ci [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 复制代码 -
重启mysql:
systemctl restart mysqld -
开机启动:
systemctl enable mysqld -
取消使用yum时每次都加载mysql:
yum -y remove mysql57-community-release-el7-8.noarch
-




近期评论