赞
踩
MySQL8.0.34安装到ubuntu-22.04.3服务器
官网下载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
# 切换roo用户,是否安装过MySQL,mariadb
sudo dpkg -l | grep mariadb
# 如果有就卸载
sudo dpkg -P mariadb
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
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';
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。