1. 查看我的linux版本
lsb_release -a
2. 安装mysql server
sudo apt-get update
sudo apt-get install mysql-server
sudo apt-get install mysql-client
3. 安装完成后,查看3306端口是否正常
netstat -an | grep 3306
4. 修改Mysql配置文件,注意安装路径
vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到
bind-address = 127.0.0.1
并注释
wq
保存并退出
5. 重启Mysql
/etc/init.d/mysql restart
6. 启动完成后,查看3306端口是否正常
netstat -an | grep 3306
7. 修改用户权限
mysql -uroot -p
#修改密码
set password for root@localhost = password('123');
use mysql;
update user set Host = '%' where User='root';
flush privileges; #刷新一下
8. 本地工具连接
9. 卸载
sudo apt-get remove mysql-*
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
解决1251 client does not support ...问题
1.查看用户信息
select host,user,plugin,authentication_string from mysql.user;
备注:host为 % 表示不限制ip localhost表示本机使用 plugin非mysql_native_password 则需要修改密码
2.修改用户密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
更新user为root,host为% 的密码为123456