CentOS7.X rpm安装 mysql 5.7.24(无网络情况)

环境准备:

事先准备好rpm包:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

下载版本

安装MySQL5.7

> tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

> yum remove mysql-libs

> rpm -ivh mysql-community-common-5.7.24-1.el7.x86_64.rpm

> rpm -ivh mysql-community-libs-5.7.24-1.el7.x86_64.rpm

> rpm -ivh mysql-community-client-5.7.24-1.el7.x86_64.rpm

> rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm

启动服务:

> systemctl start mysqld

查询默认密码:

> cat /var/log/mysqld.log | grep password

使用默认密码登录:

> mysql -u root -p

修改密码:

> use mysql;

> SET PASSWORD = PASSWORD('UMF@root@123');

> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

> FLUSH PRIVILEGES;

允许远程连接:

> update user set host = '%' where user = 'root';

> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'UMF@root@123' WITH GRANT OPTION;

> FLUSH PRIVILEGES;

> exit;

> systemctl stop mysqld.service

无密码检查登录:

> vi /etc/my.cnf

在最后一行增加 skip-grant-tables 并保存

设置大小写敏感:

lower_case_table_names = 0时,mysql会根据表名直接操作,大小写敏感。

lower_case_table_names = 1时,mysql会先把表名转为小写,再执行操作。

> systemctl start mysqld.service

> mysql -h {ip} -P 3306 -u root -p

创建数据源

> create database dir_manager;

> use dir_manager;

> source {.sql文件目录}

你可能感兴趣的:(CentOS7.X rpm安装 mysql 5.7.24(无网络情况))