修改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. ajax 异步交互

    <script>     $(function(){         $("#sub").click(function () {             $.ajax( ...

  2. Shell 编程基础之 For 练习

    一.语法 for var in con1 con2 con3 ... do # 执行内容 done for var in {min..max} do # 执行内容 done for (( 初始值; 限 ...

  3. uva-465(overflow)

    这道题很奇葩啊,WA了4发...妈的,用c++也不至于,输出竟然要原样输出... 例如: 0000000000000000006 * 000000000000001 输出是 0000000000000 ...

  4. Storm实战:在云上搭建大规模实时数据流处理系统(Storm+Kafka)

    在大数据时代,数据规模变得越来越大.由于数据的增长速度和非结构化的特性,常用的软硬件工具已无法在用户可容忍的时间内对数据进行采集.管理和处理.本文主要介绍如何在阿里云上使用Kafka和Storm搭建大 ...

  5. Ext中Grid重新load设置URL

    一.前言    Extjs中grid网格有时候需要重新加载,加载的时候对应不同的URL,什么情况出现:有需要我们在添加附件的时候,添加完成了附件,需要把另一个show添加的数据重新加载到grid中,而 ...

  6. BZOJ3212 Pku3468 A Simple Problem with Integers 题解

    题目大意: 一个数列,有两个操作:1.修改操作,将一段区间内的数加上c:2.查询操作,查询一段区间内的数的和. 思路: 线段树裸题,区间修改.区间查询,维护和以及加上的数,由于无序,不需要向下推标记, ...

  7. ubifs扩展性分析

    文件系统的可扩展性,主要考察flash规模变大时对文件系统性能的影响,主要考察指标有: mount时间 访问时间 检查修复时间 最大文件大小 最大文件系统大小 最大文件个数   mount时间     ...

  8. topcoder SRM 625 DIV2 IncrementingSequence

    由于题目数据量比较小,故可以开辟一个数组存储每个index出现的次数 然后遍历即可 string canItBeDone(int k, vector<int> A){ vector< ...

  9. ACM 兰州烧饼

    兰州烧饼 时间限制:1000 ms  |  内存限制:65535 KB 难度:1   描述 烧饼有两面,要做好一个兰州烧饼,要两面都弄热.当然,一次只能弄一个的话,效率就太低了.有这么一个大平底锅,一 ...

  10. UIColletionView 的属性与常用方法介绍

    UICollectionView基础   初始化部分: UICollectionViewFlowLayout *flowLayout= [[UICollectionViewFlowLayout all ...