MySQL8.0.34安装到ubuntu-22.04.3服务器

MySQL8.0.34安装到ubuntu-22.04.3服务器

第一步:官网下载MySQL-8.0.34:https://downloads.mysql.com/archives/community/

官网下载MySQL-8.0.34:https://downloads.mysql.com/archives/community/

根据自己操作系统的架构选择合适的版本进行下载(我的的X86_64) # uname-a 查看系统架构

Product Version:8.0.34

Operating System:Ubuntu Linux

OS Version:Ubuntu Linux 22.04 (x86, 64-bit)

下载:mysql-server_8.0.34-1ubuntu22.04_amd64.deb-bundle.tar

MySQL8.0.34安装到ubuntu-22.04.3服务器_第1张图片

第二步:检查当前系统是否安装过MySQL,如果存在就是用下列命令移除,如果不存在则忽略;

# 切换roo用户,是否安装过MySQL,mariadb

sudo dpkg -l | grep mariadb

# 如果有就卸载

sudo dpkg -P mariadb

第三步:将MySQL-8.0.34安装包上传到服务器,解压

sudo tar -xvf mysql-server_8.0.34-1ubuntu22.04_amd64.deb-bundle.tar -C ./mysql

第四步:改一下所属权限

sudo chown root:root -R mysql

第五步:安装依赖环境

sudo apt-get install libaio1

第六步:安装deb包(注意顺序)

sudo dpkg -i mysql-common_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-community-client-plugins_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i libmysqlclient21_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i libmysqlclient-dev_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-community-client-core_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-community-client_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-client_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-community-server-core_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-community-server_8.0.34-1ubuntu22.04_amd64.deb

sudo dpkg -i mysql-server_8.0.34-1ubuntu22.04_amd64.deb

可选安装

mysql-community-server-debug_8.0.34-1ubuntu22.04_amd64.deb

mysql-community-test_8.0.34-1ubuntu22.04_amd64.deb

mysql-community-test-debug_8.0.34-1ubuntu22.04_amd64.deb

mysql-testsuite_8.0.34-1ubuntu22.04_amd64.deb

第七步:登录

# mysql命令,无需输入任何东西

mysql

# 修改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';

第八步:配置mysql

sudo mysql_secure_installation

初始化配置信息

VALIDATE PASSWORD COMPONENT.....(使用密码强度校验组件)输入: n

New Password:(设置新密码,并重复一遍)

Remove anonymous users (删除匿名用户) n

Disallow root login remotely(拒绝远程root账号登录) n

Remove test database and access to it(移除test数据库) n

Reload privilege tables now (现在就重新载入权限表)) y

第九步:远程登录(关闭防火墙);

mysql -hlocalhost -P3306 -uroot -p12345678

use mysql;

select Host,User from user;

update user set host = '%' where user ='root';

flush privileges;

第十步:开机启动相关;

sudo systemctl start mysql

sudo systemctl stop mysql

sudo systemctl enable mysql

sudo systemctl disable mysql

sudo systemctl status mysql

第十一步:常用目录

数据库文件的存放路径:/var/lib/mysql

相关命令存放路径:/usr/bin和/usr/sbin

配置文件存放路径:/usr/share/和/etc/mysql





 

你可能感兴趣的:(MYSQL,ubuntu,adb)