1. 创建MySQL安装目录
mkdir -p app/soft//mysql
2. 进入MySQL安装目录,下载,安装
cd /app/soft/mysql/
wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
得到安装包:
解压安装包:
查看系统是否自带自带的数据库 mariadb
如果画框中的内容有,则rpm -e --nodeps XXX删除:
rpm -e --nodeps mariadb-connector-c-3.1.11-2.oc8.1.x86_64
rpm -e --nodeps mariadb-connector-c-config-3.1.11-2.oc8.1.noarch
安装:
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
yum install libncurses*
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
3. 启动并测试连接
查看密码:
进入输入密码:
mysql -u root -p
修改密码:
set global validate_password_policy=0;
set global validate_password_length=1;
alter user ‘root’@‘localhost’ identified by ‘你的密码’;
刷新:
继续执行:
use mysql;
SELECT Host, User FROM user;
UPDATE user SET Host = ‘%’ WHERE User = ‘root’;
flush privileges;
测试连接:
成功: