Linux ----mysql
修改mysql路径,my.ini-----datadir
添加数据库名
①lnmp database add
②输入mysql主密码(root本地)
③输入数据库名,密码
![](https://images2015.cnblogs.com/blog/686151/201611/686151-20161114103510248-329931219.png)
这是本地数据库建好了,本地---转---远程
①登录mysql: mysql -u root -p 回车输入密码
查看全部数据库名: show databases;
②use mysql;
查看 用户 是否存在: select host,user from user where 1;
③更新数据或重新创建用户(远程)
update user set host=% where user=用户名(更新)
create user(创建),最后一张图
mysql> use mysql;
Database changed
mysql> update user set host='%' where user='yangsheng';
修改密码:字段可能变了(authentication_string)
mysql> use mysql;
Database changed
mysql> update user set authentication_string='yangsheng' where user='yangsheng';
④查看是否改成功
select host,user from user where 1;
给root权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD 'root' WITH GRANT OPTION
查看root用户权限
show grants for root@‘%’;
⑤exit;
⑥lnmp mysql restart;
![](https://images2015.cnblogs.com/blog/686151/201611/686151-20161114103529701-1714231900.png)
![](https://images2015.cnblogs.com/blog/686151/201611/686151-20161114103552529-679267381.png)
![](https://images2015.cnblogs.com/blog/686151/201611/686151-20161114103625217-293550479.png)