【Ubuntu】mysql安装
下载:https://dev.mysql.com/downloads/
version:8.0.30
su
dpkg -i mysql-connector-java_8.0.30-1ubuntu22.04_all.deb
apt-get update
apt-get install mysql-server
mysql 直连且安装过程无设置密码操作
alter user 'root'@'localhost' identified with mysql_native_password by 'your_new _password';
或
/etc/mysql/debian.cnf 临时账号存储文件
mysql -u debian-sys-maint -p 密码文件里有
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
FLUSH PRIVILEGES
exit;
远程
update user set host='%' where user = 'root';
flush privileges;
grant all on *.* to 'root'@'%';
flush privileges;
修改配置文件允许远程
vim /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉 bind-address = 127.0.0.1
systemctl restart mysql.service
虚拟机远程 连接会慢
可以在文件 /etc/mysql/my.cnf 末尾添加
[mysqld]
#DNS反向解析
skip-name-resolve

浙公网安备 33010602011771号