码迷,mamicode.com
首页 > 数据库 > 详细

mysql root 维护

时间:2016-09-25 22:24:41      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:


修改root密码:

mysql -uroot -paaa
mysql> use mysql;
mysql> UPDATE user SET password=password("aaa") WHERE user=‘root‘;  
mysql> flush privileges;
mysql> exit;

# 重启服务
service mysqld restart


增加用户:

insert into user(Host,User,Password) values("localhost","root",password("113355"));
insert into user(Host,User,Password) values("%","root",password("113355"));
insert into user(Host,User,Password) values("iz11jtfubrxz","root",password("113355"));

更新用户信息使得用户可以查看mysql库:

update user set Select_priv =‘Y‘ where user = ‘root‘;
update user set Insert_priv =‘Y‘ where user = ‘root‘;
update user set Update_priv =‘Y‘ where user = ‘root‘;
update user set Delete_priv =‘Y‘ where user = ‘root‘;
update user set Create_priv =‘Y‘ where user = ‘root‘;
update user set Drop_priv =‘Y‘ where user = ‘root‘;
update user set Reload_priv =‘Y‘ where user = ‘root‘;
update user set Shutdown_priv =‘Y‘ where user = ‘root‘;
update user set Process_priv =‘Y‘ where user = ‘root‘;
update user set File_priv =‘Y‘ where user = ‘root‘;
update user set Grant_priv =‘Y‘ where user = ‘root‘;
update user set References_priv =‘Y‘ where user = ‘root‘;
update user set Index_priv =‘Y‘ where user = ‘root‘;
update user set Alter_priv =‘Y‘ where user = ‘root‘;
update user set Show_db_priv =‘Y‘ where user = ‘root‘;
update user set Super_priv =‘Y‘ where user = ‘root‘;
update user set Create_tmp_table_priv =‘Y‘ where user = ‘root‘;
update user set Lock_tables_priv =‘Y‘ where user = ‘root‘;
update user set Execute_priv =‘Y‘ where user = ‘root‘;
update user set Repl_slave_priv =‘Y‘ where user = ‘root‘;
update user set Repl_client_priv =‘Y‘ where user = ‘root‘;
update user set Create_view_priv =‘Y‘ where user = ‘root‘;
update user set Show_view_priv =‘Y‘ where user = ‘root‘;
update user set Create_routine_priv =‘Y‘ where user = ‘root‘;
update user set Alter_routine_priv =‘Y‘ where user = ‘root‘;
update user set Create_user_priv =‘Y‘ where user = ‘root‘;
update user set Event_priv =‘Y‘ where user = ‘root‘;
update user set Trigger_priv =‘Y‘ where user = ‘root‘;


 

my.cnf配置

[mysqld]
#datadir=/var/lib/mysql
datadir=/xxx/mydqldate/
#socket=/var/lib/mysql/mysql.sock
socket=/data/mydqldate/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
default-character-set=utf8
lower_case_table_names=1
#skip-grant-tables

[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

mysql root 维护

标签:

原文地址:http://www.cnblogs.com/rigid/p/5906968.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!