1、安装
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
2、查看默认账号和密码
sudo vim /etc/mysql/debian.cnf
选取其中的user、password,以上图(具体根据自己的)
user = debian-sys-maint
password = UkGiQ2xFWqJuYTVw
为例
3、利用默认账号和密码登录
sudo mysql -u debian-sys-maint -pUkGiQ2xFWqJuYTVw
4、设置root密码
update mysql.user set authentication_string=password('123456') where user='root'and Host = 'localhost';
5、查看并修改用户权限
use mysql;
select user,host,plugin from user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
6、开启MySQL的远程连接权限
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
7、在Navicat中创建连接
在Navicat中:文件->新建连接->MySQL…
连接成功
8、MySQL相关命令
service mysql start //启动
service mysql stop //停止
service mysql restart //重启
service mysql status //查看状态