VMware16 CentOS8.2 MySQL:5.5.58.rpm包
rpm -qa|grep -i mysql
rpm -e rpm包 yum -y remove mysql* 如果卸载不掉,mysql可直接换成检测到的包名 rm -rf /var/lib/mysql rm /etc/my.cnf
1.安装MySQL-server
[root@centos8 linux_mysql]# rpm -ivh MySQL-server-5.5.58-1.el6.x86_64.rpm --force --nodeps 警告:MySQL-server-5.5.58-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:MySQL-server-5.5.58-1.el6 ################################# [100%] 220706 20:41:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 220706 20:41:34 [Note] /usr/sbin/mysqld (mysqld 5.5.58) starting as process 33380 ... 220706 20:41:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 220706 20:41:34 [Note] /usr/sbin/mysqld (mysqld 5.5.58) starting as process 33387 ... PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h centos8 password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. Please report any problems at http://bugs.mysql.com/
2.安装mysql-client
[root@centos8 linux_mysql]# rpm -ivh MySQL-client-5.5.58-1.el6.x86_64.rpm --force --nodeps 警告:MySQL-client-5.5.58-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:MySQL-client-5.5.58-1.el6 ################################# [100%] [root@centos8 linux_mysql]#
查看Mysql安装时创建的mysql用户和mysql组
[root@centos8 linux_mysql]# cat /etc/passwd|grep mysql mysql:x:975:973:MySQL server:/var/lib/mysql:/bin/bash [root@centos8 linux_mysql]# [root@centos8 linux_mysql]# cat /etc/group|grep mysql mysql:x:973: [root@centos8 linux_mysql]#
查看mysql版本
[root@centos8 linux_mysql]# mysqladmin --version mysqladmin Ver 8.42 Distrib 5.5.58, for Linux on x86_64
/usr/bin/mysqladmin -u root password '新密码'
systemctl start mysqld.server
systemctl stop mysqld.server
systemctl enable mysqld.server 设置开机自启动
[root@centos8 ~]# firewall-cmd --add-port=3306/tcp --permanent success [root@centos8 ~]#
原因:yum安装GPG keys ,不安装的话 安装mysql rpm包时要加 --force --nodeps
systemctl status mysql.service 查看服务状态 --》 有报错 没有权限
ps -ef | grep mysql 查看服务权限
解决:关闭selinux,重新启动
vim /etc/sysconfig/selinux 设置为disabled