赞
踩
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html
https://dev.mysql.com/downloads/repo/yum/
注意需要根据linux的版本选择对应的仓库
yum localinstall mysql80-community-release-el7-3.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 153
mysql-tools-community/x86_64 MySQL Tools Community 110
mysql80-community/x86_64 MySQL 8.0 Community Server 424
修改为安装5.7
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
mysql-connectors-community/x86_64 MySQL Connectors Community 153
mysql-tools-community/x86_64 MySQL Tools Community 110
mysql57-community/x86_64 MySQL 5.7 Community Server 424
yum install mysql-community-server
service mysqld start
service mysqld status
grep ‘temporary password’ /var/log/mysqld.log
mysql -uroot -p
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass4!’;
默认有validate_password会验证密码,需要大写字母等等
set global validate_password_policy=0;
set global validate_password_length=1;
update mysql.user set host=’%’ where user=‘root’;
flush privileges;
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
#在[mysqld]部分添加:
character-set-server=utf8
#在文件末尾新增[client]段,并在[client]段添加:
default-character-set=utf8
vim /etc/my.cnf
[mysqld]
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
character-set-server=utf8
[client]
default-character-set=utf8
#启动之前需要生成临时密码,需要用到证书,可能证书过期,需要进行更新操作
yum update -y
#启动mysql服务
service mysqld start
#设置mysql开机启动
chkconfig mysqld on
https://dev.mysql.com/doc/refman/5.6/en/environment-variables.html
show VARIABLES like '%dir%' ;
应该是安装的版本不对,修改了下repo,卸载之后重新安装了
看日志发现数据库初始化时候错误
yum list installed |grep mysql
yum removee -y mysql
yum update
yum clean all
yum makecache
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。