Day 16
centos7 中安装 mysql 8.x
1.下载安装包
[root@mysql~]#wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
2.解压
tar -xf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
[root@mysql ~]# ls
anaconda-ks.cfg
mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.33-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
mysql-community-common-8.0.33-1.el7.x86_64.rpm
mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
mysql-community-devel-8.0.33-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-server-8.0.33-1.el7.x86_64.rpm
mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
mysql-community-test-8.0.33-1.el7.x86_64.rpm
soft
[root@mysql ~]#rpm -ivh mysql-community-server-8.0.33-1.el7.x86_64.rpm
3.卸载mariodb
[root@mysql ~]#yum remove -y *mariadb
4.依次安装libs,client,common,server4个包
[root@mysql ~]#yum -y install mysql-community-common-8.0.33-1.el7.x86_64.rpm
[root@mysql ~]#yum install mysql-community-client-8.0.33-1.el7.x86_64.rpm
[root@mysql ~]#yum install mysql-community-libs-8.0.33-1.el7.x86_64.rpm
[root@mysql ~]#yum install -y mysql-community-server-8.0.33-1.el7.x86_64.rpm
5.初始化配置mysql
[root@mysql ~]#mysqld -initialize
6.启动mysql服务
systemctl start mysqld.service
7.开机启动mysql服务
[root@mysql ~]#systemctl enable mysqld.service
8.获得初始化密码,复制时前后都不能复制空格
[root@mysql ~]#cat /var/log/mysqld.log|grep password
9.登录管理,将复制的密码粘贴到输入密码的区域实现登录
[root@mysql ~]#mysql -uroot -p
[root@mysql ~]#fg # 退出指令
10.设置新的密码
11.退出登录
数据库的管理
1.数据库的对象
1)数据库系统 DBMS
2)数据库 DB
3)表 table
4)记录 record
5)字段 feild
数据库操作
1)删除库
2)创建库
3)查看库
数据表的操作
1)选择库
2)查看表
3)创建表
4)删除表
5)修改表(新增列、修改列名、删除列)
记录的操作
1)新增
2)删除
3)修改