mysql服务端安装
- sudo apt install mysql-server
mysql客户端安装
- sudo apt install mysql-client
mysql客户端依赖库
- sudo apt install libmysqlclient-dev
修改配置文件,注释掉bind 127.0.0.1
- sudo gedit /etc/mysql/mysql.conf.d/mysql.cnf
登入mysql
- mysql -u root -p
- 允许说有ip访问
- grant all on . to root@’%’ identified by 'mysql’with grant option;
- 刷新权限
- flush privileges;
- 重启mysql
- service mysql restart
修改root登陆密码
- use mysql
- update user set plugin=‘mysql_native_password’, authentication_string=password(“123456”) where user=’‘root’’;
- flush privileges;