当前位置:   article > 正文

Debian11安装MySQL8.0,链接Navicat_debian 11 安装mysql8.0

debian 11 安装mysql8.0

记录于2023年9月,Debian11 、 MySQL 8.0.34

1 下载安装MySQL

1.1 从MySQL官网下载安装文件

打开 MySQL官网 ,按照下图所示,下载config文件:
在这里插入图片描述
继续
在这里插入图片描述
继续
在这里插入图片描述
跳过登录,直接下载:
在这里插入图片描述
将下载的 mysql-apt-config_0.8.26-1_all.deb 文件,上传至Debian的某一个目录(随意),比如 /gisleung

1.2 安装MySQL

使用以下命令安装:

cd /gisleung
sudo dpkg -i mysql-apt-config_0.8.26-1_all.deb
  • 1
  • 2

按照下图所示,继续:
在这里插入图片描述
使用键盘的 ,选中 ok 继续执行:

# 执行成功后,首先进行更新
sudo apt-get update
# 安装 mysql
sudo apt-get install mysql-server
  • 1
  • 2
  • 3
  • 4

等待安装过程,到(连续2次)输入密码的页面:
在这里插入图片描述
请务必选择第2个,否则Navicat不好连接
在这里插入图片描述

查看mysql运行状态

systemctl status mysql
netstat -ntulp | grep 3306
  • 1
  • 2

执行一些默认安全设置:

# 请跳过,如果后面遇到错误再
# sudo mysql_secure_installation
  • 1
  • 2

在这里插入图片描述

其它的指令:

# 开启mysql
systemctl enable mysql
# 禁用mysql
systemctl disable mysql
# 重启mysql
systemctl restart mysql
# 关闭mysql
systemctl stop mysql
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

1.3 登录MySQL

mysql -u root -p
# 然后输入安装时设置的密码:
  • 1
  • 2

登陆成功:
在这里插入图片描述

2 配置Navicat远程访问

2.1 修改配置

mysql -u root -p
# 以下命令为 mysql> 命令行环境下使用
use mysql;
# 直接指定root的host 参数
update user set host='%' where user='root';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
# 查看所有用户的情况
select User, host from mysql.user;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

在这里插入图片描述

2.2 Navicat 连接

在这里插入图片描述

默认的数据库:

在这里插入图片描述

end: 卸载 MySQL

sudo systemctl stop mysql
sudo apt-get autoremove mysql-server
sudo apt-get -f install
sudo apt-get remove --purge mysql-\*
# sudo apt-get install mysql-server mysql-client
  • 1
  • 2
  • 3
  • 4
  • 5

———————— 结束。
参考:
https://blog.csdn.net/wmmhdt/article/details/130879921
https://blog.csdn.net/mazeyqian/article/details/131617500

**碎碎念:**有人说要 改 /etc/mysql/mysql.conf.d/mysqld.cnf 文件,在后面追加什么东西。。。我没有操作这一步,一样可以。。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/323153
推荐阅读
相关标签
  

闽ICP备14008679号