使用wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar 下载所需的安装包。 使用tar -xvf mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar 进行解压。
使用rpm -ivh mysql-community-common-5.7.35-1.el7.x86_64.rpm 进行安装的时候,报下边的错误:
warning: mysql-community-common-5.7.35-1.el7.x86_64.rpm: Header V3 DSA/SHA256 Signature, key ID 5072e1f5: NOKEY
Preparing...
file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/english/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/german/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/greek/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/italian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/japanese/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/korean/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/polish/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/romanian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/russian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/serbian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/slovak/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/spanish/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/Index.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/ascii.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp1250.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp1251.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp1256.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp1257.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp850.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp852.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/cp866.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/dec8.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/geostd8.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/greek.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/hebrew.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/hp8.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/keybcs2.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/koi8r.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/koi8u.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/latin1.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/latin2.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/latin5.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/latin7.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/macce.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/macroman.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
file /usr/share/mysql/charsets/swe7.xml from install of mysql-community-common-5.7.35-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86_64
使用rpm -qa | grep maria 可以查看安装了maria开头的什么软件。 使用yum remove mariadb-libs-5.5.60-1.el7_5.x86_64 进行卸载。 再次使用rpm -ivh mysql-community-common-5.7.35-1.el7.x86_64.rpm 。 使用rpm -ivh mysql-community-libs-5.7.35-1.el7.x86_64.rpm 安装mysql-community-libs。 使用rpm -ivh mysql-community-client-5.7.35-1.el7.x86_64.rpm 安装mysql-community-client。
使用rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm 安装的时候,报错:
warning: mysql-community-server-5.7.35-1.el7.x86_64.rpm: Header V3 DSA/SHA256 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libaio.so.1()(64bit) is needed by mysql-community-server-5.7.35-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.35-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.35-1.el7.x86_64
使用yum search libaio 查询一下可以安装的缺少的依赖包。 使用yum install libaio.x86_64 libaio-devel.x86_64 -y 可以安装依赖包。 使用rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm 进行安装mysql-community-server,安装成功。 systemctl start mysqld 启动MySQL客户端。 systemctl status mysqld 查看MySQL客户端的状态。Active的状态是“active (running)”表明是正常启动。 使用grep "password" /var/log/mysqld.log 可以查看随机生成的密码。 使用 mysql -uroot -p 然后按回车键,输入密码之后再按回车键,正确的话就会显示下边这样类似的字样:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.35
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> 是提示符,在后边可以输入SQL语句,比如显示所有的数据库show databases; 但是发现报下边的问题:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
这个是要我先修改密码,就是将默认密码改成自己的密码。 使用ALTER USER '用户名'@'网址' IDENTIFIED BY '密码'; 进行设置,就像ALTER USER 'root'@'localhost' IDENTIFIED BY 'ILoveYou#123'; 这样,其中root 是用户名,localhost 使用网址,而ILoveYou#123 是密码,注意密码需要有大小字母、数字和特殊字符组成,出现“Query OK”这样的字样就表明设置密码成功。 使用 exit; 可以退出MySQL客户端。 使用mysql -u用户名 -p密码 可以进入到MySQL客户端,例如mysql -uroot -pILoveYou#123 。 使用show databases; 显示所有的数据库。 systemctl stop mysqld 是关闭MySQL客户端的命令。然后再使用systemctl status mysqld 查看的话, Active对应的值为“inactive (dead)”,就如下图所示: 有一个配置问题,我认为很重要:如何让远程ip也能访问MySQL客户端。 grant all privileges on *.* to 'root'@'%' identified by 'ILoveyou#3' with grant option; 这个命令就是将所有的权限(*.*)通过用户(root)和密码“ILoveyou#3”赋给所有ip(“%”)。使用flush privileges; 刷新MySQL的系统权限相关表,立即生效。 发现使用Navicat无法连接上。 进入到阿里云官网,然后找到对应的ECS实例,配置安全组规则。 点击配置规则。 点击快速添加。
首先选择“MySQL(3306)”,然后点击“确定” 再次用Navicat测试,发现成功了。
|