1,mysql 1449 : The user specified as a definer (‘root’@’%’) does not exist
2,mysql出现Can’t connect to MySQL server on (111 “Connection refused”)
3,MySQL提示ERROR 1698 (28000): Access denied for user ‘root’@‘localhost’
ubuntu 安装mysql8 以及坑(倒着微笑)
ubuntu安装
下载步骤 8.0.20
1,sudo apt-get update
2,sudo apt-get install mysql-server # 这里直接安装的是最新的8.0.20
# 指定版本安装以及查看可安装版本
以后再补充。。。。。。
ubuntu 卸载mysql8
dpkg --list|grep mysql
sudo apt-get autoremove --purge mysql-server-8.0
dpkg -l|grep ^rc|awk ‘{print$2}’|sudo xargs dpkg -P
sudo apt-get autoremove --purge mysql-common
rm -fr /var/lib/mysql
dpkg --list|grep mysql
mysql8.0.20root没有密码无法登陆,无法远程登陆
安装过程未生成数据库密码,直接结束。正确登陆姿势:
sudo cat /etc/mysql/debian.cnf # 查看默认的
每个人的机器不一样的密码,用这个登陆进去就能愉快的玩耍了,在创建个新用户
```user 用户名称 debian-sys-maint```
```password 用户密码```
用默认的用户登陆进去之后 创建新的用户
use mysql;
生成新用户
create user 'username'@'localhost' identified by 'password’; # 本地
create user 'username'@'%' identified by 'password'; # 权限 远程链接
授予权限
grant all privileges on *.* to 'username'@'localhost' with grant option;
修改加密方式:
ALTER USER 'test’@‘%' IDENTIFIED BY ‘Xueyiyang' PASSWORD EXPIRE NEVER;
无法远程登陆
1,是否添加%权限
2,是否开放 3306端口(默认端口)
3,修改配置文件
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到bind-address = 127.0.0.1,将绑定地址改成0.0.0.0
ps:弄了两天 希望后来人不要花太多时间踩这种坑,更多精力放在逻辑开发上 (正着微微笑)