kali linux 上安装MySQL 8.0.16

时间:2024-03-07 18:47:29

下载地址
MySQL Community Server 8.0.16


Debian Linux
Debian Linux 9 (x86, 64-bit)

下载的所有deb包如下:
有用到的
mysql-client_8.0.16-2debian9_amd64.deb
mysql-common_8.0.16-2debian9_amd64.deb
mysql-community-client_8.0.16-2debian9_amd64.deb
mysql-community-client-core_8.0.16-2debian9_amd64.deb
mysql-community-server_8.0.16-2debian9_amd64.deb
mysql-community-server-core_8.0.16-2debian9_amd64.deb
mysql-server_8.0.16-2debian9_amd64.deb
没有用到的
libmysqlclient21_8.0.16-2debian9_amd64.deb
libmysqlclient-dev_8.0.16-2debian9_amd64.deb
mysql-server_8.0.16-2debian9_amd64.deb-bundle.tar

安装顺序如下,Let‘s go

root@root:/b# dpkg -l |grep mysql
ii mysql-apt-config 0.8.13-1 all Auto configuration for MySQL APT Repo.
ii mysql-common 8.0.16-2debian9 amd64 Common files shared between packages
root@root:/b# dpkg --purge mysql-common
(正在读取数据库 ... 系统当前共安装有 117398 个文件和目录。)
正在卸载 mysql-common (8.0.16-2debian9) ...
正在清除 mysql-common (8.0.16-2debian9) 的配置文件 ...
update-alternatives: 警告: 侯选项 /etc/mysql/my.cnf.fallback(链接组 my.cnf 的一部分)不存在;从候选项列表中移除。
update-alternatives: 警告: /etc/alternatives/my.cnf 正处于未决状态;将以最佳选项更新它。
root@root:/b# ^C
root@root:/b# dpkg --purge mysql-apt-config
(正在读取数据库 ... 系统当前共安装有 117385 个文件和目录。)
正在卸载 mysql-apt-config (0.8.13-1) ...
正在清除 mysql-apt-config (0.8.13-1) 的配置文件 ...
root@root:/b# ls
mariadb-server_5.5.36
MySQL.zip
root@root:/b# cd mysql-8.0.16-community/
root@root:/b/mysql-8.0.16-community# dpkg -i mysql-common_8.0.16-2debian9_amd64.deb
正在选中未选择的软件包 mysql-common。
(正在读取数据库 ... 系统当前共安装有 117380 个文件和目录。)
正准备解包 mysql-common_8.0.16-2debian9_amd64.deb ...
正在解包 mysql-common (8.0.16-2debian9) ...
正在设置 mysql-common (8.0.16-2debian9) ...
update-alternatives: 使用 /etc/mysql/my.cnf.fallback 来在自动模式中提供 /etc/mysql/my.cnf (my.cnf)
root@root:/b/mysql-8.0.16-community# dpkg -l | grep mysql
ii mysql-common 8.0.16-2debian9 amd64 Common files shared between packages

root@root:/b/mysql-8.0.16-community# dpkg -i mysql-community-client-core_8.0.16-2debian9_amd64.deb
正在选中未选择的软件包 mysql-community-client-core。
(正在读取数据库 ... 系统当前共安装有 117616 个文件和目录。)
正准备解包 mysql-community-client-core_8.0.16-2debian9_amd64.deb ...
正在解包 mysql-community-client-core (8.0.16-2debian9) ...
正在设置 mysql-community-client-core (8.0.16-2debian9) ...
正在处理用于 man-db (2.8.3-2) 的触发器 ...
root@root:/b/mysql-8.0.16-community# dpkg -i mysql-community-client_8.0.16-2debian9_amd64.deb
(正在读取数据库 ... 系统当前共安装有 117628 个文件和目录。)
正准备解包 mysql-community-client_8.0.16-2debian9_amd64.deb ...
正在将 mysql-community-client (8.0.16-2debian9) 解包到 (8.0.16-2debian9) 上 ...
正在设置 mysql-community-client (8.0.16-2debian9) ...
正在处理用于 man-db (2.8.3-2) 的触发器 ...
root@root:/b/mysql-8.0.16-community# dpkg -i mysql-client_8.0.16-2debian9_amd64.deb
(正在读取数据库 ... 系统当前共安装有 117628 个文件和目录。)
正准备解包 mysql-client_8.0.16-2debian9_amd64.deb ...
正在将 mysql-client (8.0.16-2debian9) 解包到 (8.0.16-2debian9) 上 ...
正在设置 mysql-client (8.0.16-2debian9) ...
root@root:/b/mysql-8.0.16-community# dpkg -i mysql-community-server_8.0.16-2debian9_amd64.deb
(正在读取数据库 ... 系统当前共安装有 117628 个文件和目录。)
正准备解包 mysql-community-server_8.0.16-2debian9_amd64.deb ...
正在将 mysql-community-server (8.0.16-2debian9) 解包到 (8.0.16-2debian9) 上 ...
正在设置 mysql-community-server (8.0.16-2debian9) ...
update-alternatives: 使用 /etc/mysql/mysql.cnf 来在自动模式中提供 /etc/mysql/my.cnf (my.cnf)
mysql.service is a disabled or a static unit, not starting it.

root@root:/b/mysql-8.0.16-community# dpkg -i mysql-server_8.0.16-2debian9_amd64.deb
(正在读取数据库 ... 系统当前共安装有 117628 个文件和目录。)
正准备解包 mysql-server_8.0.16-2debian9_amd64.deb ...
正在将 mysql-server (8.0.16-2debian9) 解包到 (8.0.16-2debian9) 上 ...
正在设置 mysql-server (8.0.16-2debian9) ...
root@root:/b/mysql-8.0.16-community# service mysql start
root@root:/b/mysql-8.0.16-community# ps aux | grep mysql
mysql 3941 1.1 10.3 2048024 400088 ? Ssl 09:00 0:02 /usr/sbin/mysqld
root 4303 0.0 0.0 6236 872 pts/0 S+ 09:04 0:00 grep mysql
root@root:/b/mysql-8.0.16-community# mysql -u root
ERROR 1045 (28000): Access denied for user \'root\'@\'localhost\' (using password: NO)
root@root:/b/mysql-8.0.16-community# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.16 |
+-----------+
1 row in set (0.00 sec)

mysql> exit
Bye

注意:安装过程中会提示输入数据库密码,请务必记住密码。