Ubuntu20_install_mysql
安装mysql8.0
apt-get update
apt-get install mysql-server
设置远程访问
#远程
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address改为0.0.0.0
#重启
/etc/init.d/mysql restart
#设置权限与密码
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码'; #使用mysql_native_password修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码' PASSWORD EXPIRE NEVER; #更新一下用户的密码
UPDATE user SET host = '%' WHERE user = 'root'; #允许远程访问
#刷新cache中配置 刷新权限
flush privileges;
quit;
初始化
#初始化
mysql_secure_installation
1. NO
2. 输入密码
3. 其余全部默认
# 检查
systemctl status mysql.service
状态
#开启
service mysql start
# 关闭
service mysql stop
# 重启
service mysql restart
# 状态
systemctl status mysql.service
其他
缺少mysql.h头文件
apt-get install libmysqlclient-dev
修改root密码8.0
use mysql;
update user set authentication_string='' where user='root';--将字段置为空
ALTER user 'root'@'localhost' IDENTIFIED BY 'root';--修改密码为root
Re:
https://blog.csdn.net/u010520724/article/details/107444032
https://blog.csdn.net/weixin_38924500/article/details/106261971