时间:2021-07-01 10:21:17 帮助过:5人阅读
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
地址:https://dev.mysql.com/downloads/repo/yum/
下载地址:https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
# yum localinstall mysql80-community-release-el7-3.noarch.rpm
# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 95
mysql-tools-community/x86_64 MySQL Tools Community 84
mysql80-community/x86_64 MySQL 8.0 Community Server 82
# yum install -y mysql-community-server
# systemctl start mysqld
默认存储路径是/var/lib/mysql,修改成/data/mysql
systemclt stop mysqld.service
mkdir /data/mysql
cp -a -R /var/lib/mysql/* /data/mysql/
chown mysql:mysql /data/mysql/
chmod 750 /data/mysql/
vim /ect/my.cnf
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
datadir=/data/mysql
socket=/data/mysql/mysql.sock
systemctl start mysqld
# 用户登录。mysql -uroot -p 输入密码,提示错误。SQLSTATE[HY000] [2002] Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘
ln -s /data/mysql/mysql.sock /var/lib/mysql/mysql.sock
systemctl start mysqld
systemctl status mysqld
# grep ‘temporary password‘ /var/log/mysqld.log
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘eSem?a?ap‘;
flush privileges;
CentOS7.X yum安装MySQL8.0
标签:lte state mysqld 默认 x86_64 emc mod unit image