Ubuntu22 安装MySQL8

科技1年前 (2023)更新 Deepincode
2.4K 0 0
Ubuntu22 安装MySQL8

安装配置包

wget https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb
dpkg -i mysql-apt-config_0.8.14-1_all.deb

apt-get update

安装mysqlserver

apt-get install mysql-server

#安装mysqlclient
apt-get install mysql-client

登陆并配置MySQL用户

mysql -uroot -p

#修改root密码
create user 'root'@'%' identified by '123456';
ALTER USER 'root'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY '123456';

#授权所有操作权限给root
grant all privileges on *.* to 'root'@'%';

刷新权限并退出

flush privileges;

#退出
exit;

配置远程登录

vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 注释掉下面这行
bind-address = 127.0.0.1
service mysql restart;
© 版权声明

相关文章

暂无评论

暂无评论...