Roger Luo

超越梦想一起飞
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

mysql usage

Posted on 2013-03-03 15:58  Roger Luo  阅读(509)  评论(0编辑  收藏  举报

Modify password for root user

1. using root account to log on mysql

mysql>set password =password(‘yourpwd’);

mysql>flush privileges;

2. using grant statement

mysql>grant all on *.* to root@’localhost’ identified by ‘yourpwd’;

mysql>flush privileges;

3. update the user table;

mysql>update user set password=password(‘yourpwd’) where user=’root’ and host=’localhost’;

mysql>flush privileges;

Add user into mysql

using root account to log on mysql

mysql>grant all on *.* to root@% identified by ‘yourpwd’;

mysql>flush privileges;

Remove user from mysql

using root account to log on mysql

mysql>use mysql;

mysql>revoke all on *.* to root@localhost;  --revoke privileges assigned to this user

mysql>delete from user where user=’root’ and host=’localhost’;

mysql>flush privileges;

Import sql file into mysql

#>mysql –uroot –p < mysql.sql

Open remote connection

1. Check the network and port whether work well. Default port for MYSQL is 3306.

2. Check the user@’%’ whether this account exists in user.

use the administrator account log on mysql

mysql>use mysql;

mysql>select user, password, host from user;

image 

if the ‘%’ host doesnot exist in user. please add it by using ‘grant’ statement;