目录
1.编译安装初始化出现的报错
2.登入mysql时报错
3.编译安装时,启动MySQL报错
4.yum 安装时的可能报错
1.启动MySQL可能出现的报错
[root@www?~]# systemctl start mysqld.service? Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.?
解决: [root@www?~]# cd /var/lib/mysql [root@www mysql]# rm -rf mysql ? [root@www?mysql]# rm -rf ./* [root@www?mysql]# systemctl start mysqld
2.登入mysql时报错
[root@www?mysql]# mysql -uroot -p? ERROR 2002(HY000):Can't connect to local MySQL server through socket /var/lib/mysql/mysql. sock
[root@www?mysql]# ls
解决:
[root@www?~]# cd /usr/local/mysql [root@www?mysql]# sudo ./support-files/mysql.server ?start Starting MySQL.. SUCCESS!?
3.编译安装时,启动MySQL报错
?[root@www?mysql]# bin/mysqld_safe --user=mysql &
2021-09-07T13:21:39.369434Z mysqld_safe error: log-error set to '/var/log/mariadb/mariadb.log', however file don't exists. Create writable for user 'mysql'. 解决: ?[root@www?mysql]# cat /etc/my.cnf ??
注:看到该文件存在mariadb的配置,可能之前安装过mariadb,没卸载干净
解决:
[root@www?mysql]# rm -rf /etc/my.cnf
[root@www-mysql mysql]# vim /etc/my.cnf [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data
4.yum 安装时的可能报错
[root@mysql ~]# yum -y install mysql-community-server? Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ....... Downloading packages: warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-client-5.7.39-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository.
?Failing package is: mysql-community-client-5.7.39-1.el7.x86_64 ?GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
原因:版本问题,官方 MySQL 存储库的 GPG 密钥已过期,无法安装或更新 MySQL 包。为 “MySQL 5.7 社区服务器” 存储库列出的 GPG 密钥已经安装,但它们对于这个包是不正确的。
解决:在运行安装程序 之前 导入2022年的密钥(密钥的年份可以修改) [root@svn ~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 然后重新安装就可以
[root@svn ~]# yum -y install mysql-community-server?
|