linux安装mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar步骤

mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar下载:

链接: https://pan.baidu.com/s/1dGsP-LvIHnuD4FZ2VmsLAw 提取码: qu66

0、卸载原有mysql依赖包
rpm -qa | grep -i mysql

rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

1、tar xvf mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar

2、安装
rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm 
rpm -ivh mysql-community-devel-5.7.23-1.el6.x86_64.rpm 
rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm 
rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm 

3、启动mysql
service mysqld start

4、获取mysql初始化密码
grep 'temporary password' /var/log/mysqld.log

5、修改mysql密码:
mysqladmin -u root -p password

6、执行mysql shell
mysql -u root -p

7、创建数据库
create database database_name;

8、创建表
create table yangdong(age int);

9、插入数据
insert into yangdong values(18);

10、查询数据
select * from yangdong

11、use mysql;

12、update user set host='%' where user='root' and host='localhost';

13、flush privileges;

你可能感兴趣的:(数据库)