自学内容网 自学内容网

ubuntu22.04搭建mysql5.7

1.1 下载mysql安装包

MySQL下载地址:MySQL :: Download MySQL Community Server (Archived Versions)

 #下载
 wget https://cdn.mysql.com/archives/mysql-5.7/mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar
 #解压
 tar -xvf ./mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar

1.2 安装依赖

#获取可用更新
sudo apt-get update
#更新
sudo apt-get upgrade
#安装依赖
sudo apt-get install libaio1
sudo apt-get install libtinfo5

1.3 设置mysql密码

#开始安装mysql
sudo dpkg -i mysql-common_5.7.29-1ubuntu18.04_amd64.deb
#此步需要输入mysql实例的root密码
sudo dpkg-preconfigure mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb

1.4 安装mysql

sudo dpkg -i libmysqlclient20_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-client_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-common_5.7.29-1ubuntu18.04_amd64.deb

1.5 安装mysql服务

#安装依赖
sudo apt-get -f install libmecab2
 
#安装mysql服务
sudo dpkg -i mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-server_5.7.29-1ubuntu18.04_amd64.deb

1.6 登录mysql

# 检查MySQL状态
 systemctl status mysql
 
 #设置开机启动
systemctl enable mysql
 
 #安装完毕后进行登录,输入刚才设置的mysql实例密码
mysql -uroot -p

1.7 配置远程链接

use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'mk'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
# 如果需要远程连接,则设置
vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 把bind-address  = 127.0.0.1  注释掉 
sudo systemctl restart mysql.servi
​

在navicat上链接


原文地址:https://blog.csdn.net/weixin_45653478/article/details/140277938

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!