修改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

也可以使用如下命令:

grant usage on *.* to 'root'@'%' identified by 'qwe123' with grant option;

flush privileges;

开机启动:

chkconfig --list;
chkconfig --add mysqld;
chkconfig mysqld on;

永久关闭linux防火墙:

chkconfig --iptables off;


增加用户:

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 维护的更多相关文章

  1. MySQL root密码找回

    以MySQL多实例为例,演示找回MySQL root的密码 1.关闭mysql服务 [root@mysql ~]# mysqladmin -uroot -poldboy123 -S /data/330 ...

  2. mysql root用户kill connection报ERROR 1095 (HY000): You are not owner of thread N

    今日某系统mysql root用户kill connection时报ERROR 1095 (HY000): You are not owner of thread N 按说通过root用户具有supe ...

  3. MySQL root密码重置 报错:mysqladmin: connect to server at 'localhost' failed的解决方案

    ===========================================================二,忘记本地root的登录密码解决过程:1.编辑/mysql/my.ini在[my ...

  4. MAC 重置MySQL root 密码

    重置MySQL root 密码:当忘记密码,或者想要强行重置 MySQL 密码的时候,可以像下面这样: 1.停止 MySQL 服务 sudo /usr/local/mysql/support-file ...

  5. wamp5 忘记mysql root密码 重置方法

    wamp5比较恶心,忘记mysql root密码了,重新安装都没用,网上找了个文章可以修改root的密码. http://www.kuqin.com/database/20080306/4249.ht ...

  6. 几种破解MySQL root密码的几种方法:

    几种破解MySQL root密码的几种方法: 方法一 使用phpmyadmin,这是最简单的了,修改mysql库的user表,不过别忘了使用PASSWord函数. 方法二 使用mysqladmin,这 ...

  7. Linux - Reset a MySQL root password

    Use the following steps to reset a MySQL root password by using the command line interface. Stop the ...

  8. 使用SKIP-GRANT-TABLES 解决 MYSQL ROOT密码丢失(转)

    B.5.3.2 How to Reset the Root Password If you have never assigned a root password for MySQL, the ser ...

  9. 不重启修改mysql root密码

    不重启修改mysql root密码 --------------------2014/09/28 一.一般忘记密码的解决办法,需要重启Mysql1.skip-grant-tables我们常用的方法是使 ...

随机推荐

  1. HDU4971 A simple brute force problem.(强连通分量缩点 + 最大权闭合子图)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4971 Description There's a company with several ...

  2. POJ 1014 Dividing(多重背包)

    Dividing   Description Marsha and Bill own a collection of marbles. They want to split the collectio ...

  3. ural 2067. Friends and Berries

    2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...

  4. BZOJ3515 : EvenPaths

    首先拓扑排序,并将障碍点按拓扑序平均分成两半. 那么一条$0$到$1$的路径一定是形如: $0$->前一半点->后一半点->第一个后一半障碍点->后一半点->$1$. 对 ...

  5. Android Mvc 实现

    android studio java目录结构: Activity package目录:Controller 层 Model package目录:Model 层 View package目录:View ...

  6. 关于netstat

    netstat 命令是 linux 下一个非常有用的命令,顾名思义,其作用是查询当前的网络状态. 以最常用的查询 TCP 连接状态为例 netstat -an|awk '/tcp/ {print $6 ...

  7. 如何在电脑上测试手机网站(补充)和phonegap

    颜海镜 介绍了专业人士精准测试手机网站的经验 http://www.cnblogs.com/yanhaijing/p/3557261.html, 因为太专业了,稍显复杂和琐碎,这里我介绍下我一直关注的 ...

  8. js小效果-轮播图

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  9. Eclipse安装nodeclipse插件

    1. Start Eclipse, then select Help > Install New Software... 2. Enter the update site URL into th ...

  10. selenium grid中的多个线程同步执行

    需求:有一个工作流,每一步审批都需要多个领导参与,才能推流程到下一步去 代码思考:多个领导在自己的线程中运行,速度有的快有的慢,如何保证下一步的领导审批时,这个步骤已经激活 如下是代码:思路为:如果这 ...