目录
1、创建一个英雄表(hero)
(1)创建英雄表(hero)
(2)插入数据
(3)显示该表中所有的数据
2、博客:Linux系统安装MySQL(使用网络仓库安装)
(1)需在mysql官网找到软件仓库,并安装
(2)查看是否安装完成
(3)安装数据库mysql
(4)重启系统mysql程序
(5)进入mysql程序
1、创建一个英雄表(hero)
主键
name
nickname
address
groups
email
telphone
(1)创建英雄表(hero)
mysql> create table t_hero (name varchar(20) primary key, nickname varchar(20), address varchar(20), groupss varchar(20), email int, teelephone int);
Query OK, 0 rows affected (0.00 sec)
(2)插入数据
mysql> insert into t_hero values("猪八戒","天蓬元帅","天庭","西游记",124,421);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t_hero values("沙悟净","卷帘大将","天庭","西游记",125,521);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t_hero values("唐三藏","唐僧","东土大唐","西游记",126,621);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t_hero values("白龙马","小白龙","东海龙宫","西游记",127,721);
Query OK, 1 row affected (0.01 sec)
mysql> insert into t_hero values("刘备","刘玄德","蜀国","三国演义",128,821);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t_hero values("关羽","关云长","蜀国","三国演义",129,921);
Query OK, 1 row affected (0.00 sec)
....
(3)显示该表中所有的数据
2、博客:Linux系统安装MySQL(使用网络仓库安装)
(1)需在mysql官网找到软件仓库,并安装
https://repo.mysql.com//mysql80-community-release-el9-5.noarch.rpm —— 网络仓库
rpm
-i
https://repo.mysql.com//mysql80-community-release-el9-5.noarch.rpm
通过rpm -i 将网络仓库安装到Linux系统
(2)查看是否安装完成
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ll
总用量 20
-rw-r--r--. 1 root root 2129 10月 24 21:13 mysql-community-debuginfo.repo
-rw-r--r--. 1 root root 1910 10月 24 21:13 mysql-community.repo
-rw-r--r--. 1 root root 1989 10月 24 21:13 mysql-community-source.repo
-rw-r--r--. 1 root root 358 1月 8 18:02 redhat.repo
-rw-r--r--. 1 root root 128 1月 8 18:00 rpm.repo
(3)安装数据库mysql
[root@localhost ~]
# dnf install mysql-server -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use
subscription-manager to register.
Last metadata expiration check:
5
:09:04 ago on Wed
03
Jan
2024 11
:28:41 AM CST.
Dependencies resolved.
=================================================================================
=====================================
Package Architecture Version
Repository Size
=================================================================================
=====================================
Installing:
mysql-community-server x86_64
8
.0.35-1.el9
mysql80-community
49
M
Installing dependencies:
mysql-community-client x86_64
8
.0.35-1.el9
mysql80-community
3
.5 M
mysql-community-client-plugins x86_64
8
.0.35-1.el9
mysql80-community
1
.4 M
mysql-community-common x86_64
8
.0.35-1.el9
mysql80-community
557
k
mysql-community-icu-data-files x86_64
8
.0.35-1.el9
mysql80-community
2
.3 M
mysql-community-libs x86_64
8
.0.35-1.el9
mysql80-community
1
.4 M
Transaction Summary
=================================================================================
=====================================
Install
6
Packages
Total download size:
58
M
Installed size:
334
M
Downloading Packages:
(1/6): mysql-community-common-8.0.35-1.el9.x86_64.rpm
246
kB/s |
557
kB
00
:02
(2/6): mysql-community-client-plugins-8.0.35-1.el9.x86_64.rpm
611
kB/s |
1
.4 MB
00
:02
(3/6): mysql-community-libs-8.0.35-1.el9.x86_64.rpm
2
.5 MB/s |
1
.4 MB
00
:00
(4/6): mysql-community-icu-data-files-8.0.35-1.el9.x86_64.rpm
2
.1 MB/s |
2
.3 MB
00
:01
(5/6): mysql-community-client-8.0.35-1.el9.x86_64.rpm
733
kB/s |
3
.5 MB
00
:04
(6/6): mysql-community-server-8.0.35-1.el9.x86_64.rpm
6
.7 MB/s |
49
MB
00
:07
---------------------------------------------------------------------------------
-------------------------------------
Total
5
.7 MB/s |
58
MB
00
:10
MySQL
8
.0 Community Server
2
.9 MB/s |
3
.1 kB
00
:00
Importing GPG key 0xA8D3785C:
Userid :
"MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: BCA4
3417
C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
Key imported successfully
MySQL
8
.0 Community Server
2
.0 MB/s |
3
.1 kB
00
:00
Importing GPG key 0x3A79BD29:
Userid :
"MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: 859B E8D7 C586 F538 430B 19C2 467B 942D 3A79 BD29
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing :
1
/1
Installing : mysql-community-common-8.0.35-1.el9.x86_64
1
/6
Installing : mysql-community-client-plugins-8.0.35-1.el9.x86_64
2
/6
Installing : mysql-community-libs-8.0.35-1.el9.x86_64
3
/6
Running scriptlet: mysql-community-libs-8.0.35-1.el9.x86_64
3
/6
Installing : mysql-community-client-8.0.35-1.el9.x86_64
4
/6
Installing : mysql-community-icu-data-files-8.0.35-1.el9.x86_64
5
/6
Running scriptlet: mysql-community-server-8.0.35-1.el9.x86_64
6
/6
Installing : mysql-community-server-8.0.35-1.el9.x86_64
6
/6
Running scriptlet: mysql-community-server-8.0.35-1.el9.x86_64
6
/6
Verifying : mysql-community-client-8.0.35-1.el9.x86_64
1
/6
Verifying : mysql-community-client-plugins-8.0.35-1.el9.x86_64
2
/6
Verifying : mysql-community-common-8.0.35-1.el9.x86_64
3
/6
Verifying : mysql-community-icu-data-files-8.0.35-1.el9.x86_64
4
/6
Verifying : mysql-community-libs-8.0.35-1.el9.x86_64
5
/6
Verifying : mysql-community-server-8.0.35-1.el9.x86_64
6
/6
Installed products updated.
Installed:
mysql-community-client-8.0.35-1.el9.x86_64 mysql-community-client
plugins-8.0.35-1.el9.x86_64
mysql-community-common-8.0.35-1.el9.x86_64 mysql-community-icu-data
files-8.0.35-1.el9.x86_64
mysql-community-libs-8.0.35-1.el9.x86_64 mysql-community-server-
8.0.35-1.el9.x86_64
Complete!
(4)重启系统mysql程序
[root@localhost ~]
# systemctl start mysqld
(5)进入mysql程序
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.35 MySQL Community Server - GPL
Copyright (c) 2000, 2023, 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.