Linux 安装 MySQL 常见问题

安装 MySQL-server 出现如下

[root@master mysql]# rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm 
准备中...                          ################################# [100%]
    file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.24-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.64-1.el7.x86_64
    file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.24-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.64-1.el7.x86_64
    file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.24-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.64-1.el7.x86_64
    file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.24-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.64-1.el7.x86_64
    file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.6.24-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.64-1.el7.x86_64
    ...
    ...

原因是系统已经安装了其他版本的mysql-libs包导致不兼容。可以使用命令查看yum list | grep mysql,查看之前安装的mysql的信息

将之前的mysql的lib包删除了即可,删除mysql-libs

yum remove mysql-libs

安装 MySQL 没有临时密码

centos7 通过yum装完 mysql 5.7 ,找不到root密码

原因是原来安装过mysql残留有数据

# 第一步 删除残留文件
[root@master ~]rm -rf /var/lib/mysql

# 第二部 启动MySQL服务
[root@master ~]systemctl restart mysqld

# 查看密码
[root@master ~]grep 'temporary password' /var/log/mysqld.log
发表评论 / Comment

用心评论~