1.下载mysql必知必会上使用到的数据库,地址如下:https://download.csdn.net/download/zhaohuaxicaishi/13701929
2.解压放到linux目录下,笔者放在/mnt/hgfs/share/tmp 下共有create.sql和populate.sql两个文件。
3.通过mysql -u root -p 登录数据库。
4.执行create database crashcourse;
5.执行use crashcourse;
6.执行下载的sql脚本文件,先执行create.sql(source /mnt/hgfs/share/mysql/create.sql;)
7.执行下载的sql脚本文件source /mnt/hgfs/share/work/mysql/populate.sql;
使用populate.sql文件填充各个新表,
navicat 连接mysql
1. sudo su;进入root用户模式;
2.cd /etc/mysql/mysql.cnf.d;进入mysql的配置文件夹
3. cp mysqld.cnf mysqld_bak.cnf;对配置文件进行备份
4. vim mysqld.cnf;编辑配置文件,在如下位置输入skip-grant-tables;
5.重启mysql:service mysql restart
6.mysql -uroot;进入数据库
7.use mysql;变更数据库
8.update user set authentication_string = '' where user='root';将root用户密码置空
9.将之前mysqld.cnf中添加的skip-grant-tables删除:
10.service mysql restart;重启mysql
11.mysql -uroot ;进入数据库;
12.use mysql;
13.alter user 'root'@'localhost' identified with mysql_native_password by '新密码';
14.update user set host = '%' where user='root';将root用户的权限设置为可以远程登录
15.flush privileges;刷新用户权限
16.打开Navicat,填好相关信息,点击测试连接,成功。