Ubuntu 离线安装 MySQL 5.7.x
2022/9/13 2:24:21
本文主要是介绍Ubuntu 离线安装 MySQL 5.7.x,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1. 下载安装包
地址:
https://downloads.mysql.com/archives/community/
版本选择 (mysql-server_5.7.27-1ubuntu19.04_amd64.deb-bundle.tar)
Product Version: 5.7.27 Operating System: Ubuntu Linux OS Version: Ubuntu Linux 19.04 (x86, 64-bit)
2. 解压缩安装包
tar -xzf mysql-server_5.7.27-1ubuntu19.04_amd64.deb-bundle.tar
3. 安装依赖包
sudo apt-get update sudo apt-get upgrade sudo apt-get install libaio1 sudo apt-get install libtinfo5
4. 开始安装
sudo dpkg -i mysql-common_5.7.27-1ubuntu19.04_amd64.deb ## #此步需要输入数据的root密码 sudo dpkg-preconfigure mysql-community-server_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i libmysqlclient20_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i libmysqlclient-dev_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i libmysqld-dev_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i mysql-community-client_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i mysql-client_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i mysql-common_5.7.27-1ubuntu19.04_amd64.deb
5. 安装其他依赖包
sudo apt-get -f install sudo apt-get -f install libmecab2
6. 安装mysql-server
sudo dpkg -i mysql-community-server_5.7.27-1ubuntu19.04_amd64.deb sudo dpkg -i mysql-server_5.7.27-1ubuntu19.04_amd64.deb
7. 检测安装
mysql -u root -p
8. 初始化配置
sudo mysql_secure_installation
具体配置
#1 VALIDATE PASSWORD PLUGIN can be used to test passwords... Press y|Y for Yes, any other key for No: N (选择N,不会进行密码的强校验) #2 Please set the password for root here... New password: (输入密码) Re-enter new password: (重复输入) #3 By default, a MySQL installation has an anonymous user allowing anyone to log into MySQL without having to have a user account created for them... Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (选择N,不删除匿名用户) #4 Normally, root should only be allowed to connect from,'localhost'. This ensures that someone cannot guess at the root password from the network... Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项,选择N,允许root远程连接) #5 By default, MySQL comes with a database named 'test' that anyone can access... Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (选择N,不删除test数据库) #6 Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (选择Y,修改权限立即生效)
9. 检查MySQL服务状态
systemctl status mysql.service
10. 配置远程连接
10.1 注释掉 bind-address
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf # bind-address = 127.0.0.1 10.2 登录 mysql mysql -uroot -p >> use mysql ... >> update user set host = '%' where user='root' ...
11. 修改配置
执行: vim /etc/mysql/my.cnf 增加以下配置 [mysqld] max_allowed_packet=100M wait_timeout=2073600 lower_case_table_names=1 数据库连接配置
jdbc:mysql://10.10.1.150:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT
这篇关于Ubuntu 离线安装 MySQL 5.7.x的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解
- 2024-12-07MySQL分库分表入门指南
- 2024-12-07MySQL慢查询入门:快速掌握性能优化技巧
- 2024-12-07MySQL入门:新手必读的简单教程
- 2024-12-07MySQL入门:从零开始学习MySQL数据库
- 2024-12-07MySQL索引入门:新手快速掌握MySQL索引技巧
- 2024-12-06BinLog学习:MySQL数据库BinLog入门教程
- 2024-12-06Binlog学习:MySQL数据库的日志管理入门教程