CentOS7安装mysql5.7.11

时间:2025-01-13 11:03:39

开始安装

yum update
yum install wget
wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm
rpm -ivh mysql57-community-release-el7-.noarch.rpm
yum update
yum install mysql-server

mysql更新包201605

http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

http://repo.mysql.com/mysql57-community-release-el7.rpm

修改配置文件

vi /etc/my.cnf
port=
datadir=/data/mysqldb/mysqldata3306

安装个selinux工具

yum install policycoreutils-python

安装或初始化数据库(谨慎!!!)

service mysqld stop
rm -rf /data/mysqldb/mysqldata3306
mkdir -p /data/mysqldb/mysqldata3306
chcon -R -tmysqld_db_t /data/mysqldb/mysqldata3306
semanage fcontext -a -tmysqld_db_t /data/mysqldb/mysqldata3306
>/var/log/mysqld.log
mysqld --initialize --user=mysql --datadir=/data/mysqldb/mysqldata3306
cat /var/log/mysqld.log|grep root@localhost
service mysqld start

开通远程管理权限

mysql -uroot -p
SET PASSWORD=PASSWORD('');
GRANT ALL PRIVILEGES ON *.* TO 'adm'@'%' IDENTIFIED BY '' WITH GRANT OPTION;