默认 yum 存储库安装
yum -y install wget
wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
yum -y install mysql-community-server mysql
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld.service
grep "password" var/log/mysqld.log
mysql -u root -p
报错
vim etc/my.cnf
skip-grant-tables
service mysqld restart
mysql -u root -p
UPDATE直接编辑user表设置新密码
mysql -u root -puse mysql;update mysql.user set authentication_string=password('新密码') where user='用户名' and Host ='localhost';flush privileges;quit;
开启mysql的远程访问
grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;
为firewalld添加开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
报错
centos8.3安装mysql时报错
解决方法:
yum module disable mysqlyum -y install mysql-community-server
Error: Unable to find a match: mysql-community-server[root@localhost ~]# yum module disable mysqlLast metadata expiration check: 0:03:16 ago on Mon 21 Jun 2021 08:03:11 PM CST.Dependencies resolved.=============================================================================================Package Architecture Version Repository Size=============================================================================================Disabling modules:mysqlTransaction Summary=============================================================================================Is this ok [y/N]: yComplete![root@localhost ~]# yum -y install mysql-community-serverLast metadata expiration check: 0:03:36 ago on Mon 21 Jun 2021 08:03:11 PM CST.Dependencies resolved.=============================================================================================Package Arch Version Repository Size=============================================================================================Installing:mysql-community-server x86_64 5.7.34-1.el7 mysql57-community 173 MInstalling dependencies:mysql-community-client x86_64 5.7.34-1.el7 mysql57-community 25 Mmysql-community-common x86_64 5.7.34-1.el7 mysql57-community 310 kmysql-community-libs x86_64 5.7.34-1.el7 mysql57-community 2.4 Mncurses-compat-libs x86_64 6.1-7.20180224.el8 baseos 331 knet-tools x86_64 2.0-0.52.20160912git.el8 baseos 322 kTransaction Summary=============================================================================================Install 6 PackagesTotal download size: 202 MInstalled size: 877 MDownloading Packages:(1/6): net-tools-2.0-0.52.20160912git.el8.x86_64.rpm 320 kB/s | 322 kB 00:01(2/6): ncurses-compat-libs-6.1-7.20180224.el8.x86_64.rpm 311 kB/s | 331 kB 00:01(3/6): mysql-community-common-5.7.34-1.el7.x86_64.rpm 213 kB/s | 310 kB 00:01(4/6): mysql-community-libs-5.7.34-1.el7.x86_64.rpm 159 kB/s | 2.4 MB 00:15(5/6): mysql-community-client-5.7.34-1.el7.x86_64.rpm 683 kB/s | 25 MB 00:38(6/6): mysql-community-server-5.7.34-1.el7.x86_64.rpm 1.2 MB/s | 173 MB 02:24---------------------------------------------------------------------------------------------Total 1.4 MB/s | 202 MB 02:27warning: /var/cache/dnf/mysql57-community-65b9ecb4cc6a2553/packages/mysql-community-client-5.7.34-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYMySQL 5.7 Community Server 27 MB/s | 27 kB 00:00Importing GPG key 0x5072E1F5:Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlKey imported successfullyRunning transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transactionPreparing : 1/1Installing : mysql-community-common-5.7.34-1.el7.x86_64 1/6Installing : mysql-community-libs-5.7.34-1.el7.x86_64 2/6Running scriptlet: mysql-community-libs-5.7.34-1.el7.x86_64 2/6Installing : net-tools-2.0-0.52.20160912git.el8.x86_64 3/6Running scriptlet: net-tools-2.0-0.52.20160912git.el8.x86_64 3/6Installing : ncurses-compat-libs-6.1-7.20180224.el8.x86_64 4/6Installing : mysql-community-client-5.7.34-1.el7.x86_64 5/6Running scriptlet: mysql-community-server-5.7.34-1.el7.x86_64 6/6Installing : mysql-community-server-5.7.34-1.el7.x86_64 6/6Running scriptlet: mysql-community-server-5.7.34-1.el7.x86_64 6/6Verifying : ncurses-compat-libs-6.1-7.20180224.el8.x86_64 1/6Verifying : net-tools-2.0-0.52.20160912git.el8.x86_64 2/6Verifying : mysql-community-client-5.7.34-1.el7.x86_64 3/6Verifying : mysql-community-common-5.7.34-1.el7.x86_64 4/6Verifying : mysql-community-libs-5.7.34-1.el7.x86_64 5/6Verifying : mysql-community-server-5.7.34-1.el7.x86_64 6/6Installed:mysql-community-client-5.7.34-1.el7.x86_64 mysql-community-common-5.7.34-1.el7.x86_64mysql-community-libs-5.7.34-1.el7.x86_64 mysql-community-server-5.7.34-1.el7.x86_64ncurses-compat-libs-6.1-7.20180224.el8.x86_64 net-tools-2.0-0.52.20160912git.el8.x86_64Complete!
文章转载自SIMPLE RUDE,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。











