在Ubuntu16.04安装mysql并使用本地工具连接

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. 本地工具连接

navicat工具连接

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。