全局安装cpm
`npm install -g cnpm --registry=https://registry.npm.taobao.org`
登陆mysql
`/usr/local/mysql/bin/mysql -uroot -pfreya123`
* ![](https://img.kancloud.cn/0a/a8/0aa8e3df9c5fd5a12476f8051764edef_1276x640.png)
* 创建数据库
`create database safety;` 分号记得加
![](https://img.kancloud.cn/fc/01/fc01ea4d15dd5526708a6997137be0f3_640x130.png)
* 查看数据库
`show databases;` 分号记得加
![](https://img.kancloud.cn/b4/7c/b47c9866b2d176fabb109c88dc20beaa_570x442.png)
* 切换数据库
`use safety;` 切换到 safety数据库
![](https://img.kancloud.cn/71/d2/71d25fc2013466d3cc962965f274b38b_374x82.png)
* 创建表
`create table test(id int);`
![](https://img.kancloud.cn/af/38/af38250a8ed7a31ab8ad2e12ebe2c2d5_712x104.png)
* 展示表格
`show tables;`
![](https://img.kancloud.cn/25/05/2505256befe538b1f3bfaefc1a847d08_440x292.png)
* 导入表
`/usr/local/mysql/bin/mysql safety -uroot -pfreya123< safety.sql`
![](https://img.kancloud.cn/d7/65/d765851680eefa0bebf91fc923f078e5_1374x100.png)
## 链接mysql 显示 Clinet dose not support authentication protocol request by server ;consider upgrading MySQL client
1 在命令窗口 输入mysql -uroot -p 首先通过cmd进入mysql
2 更改加密方式
`ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;`
3 更改密码
`ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'freya123';`
这个密码是链接mysql 的密码
4刷新
`mysql> FLUSH ``PRIVILEGES``;`
`Query OK, 0 ``rows` `affected (0.28 sec)`
![](https://img.kancloud.cn/4b/64/4b647bc0cbcebd5424474dd071affcac_1622x1006.png)