`
pengleong
  • 浏览: 5897 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类

Linux下修改MySQL用户root的密码

阅读更多
装完ubuntu server-11.04忘记刚刚设计的密码,于是就在网上找了解决方案。
以下为操作全过程
sudo /etc/init.d/mysql stop

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql stop
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop mysql
mysql stop/waiting
sudo mysqld_safe --skip-grant-tables &

[1] 10528
cy@ubuntu://$ 110617 17:43:59 mysqld_safe Logging to syslog.
110617 17:43:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql mysql

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
update user set password=password('111111') where user='root';

Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
mysql>
quit

Bye
sudo killall mysqld

cy@ubuntu://$ 110617 17:45:35 mysqld_safe mysqld from pid file /var/lib/mysql/ubuntu.pid ended
[1]+  完成                    sudo mysqld_safe --skip-grant-tables
sudo /etc/init.d/mysql start

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
mysql start/running, process 10681
mysql -uroot -p111111

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

分享到:
评论

相关推荐

    修改Mysql的root密码方法

    修改Mysql的root密码方法,比较好用。希望能方便大家。

    MySQL重置root密码for Linux

    新装MySQL不知道密码,忘记MySQL密码,都可以安装该方法改过来,在Ubuntu和CentOS上用过多次。

    Linux下修改MySQL用户(root)密码的方法

    Linux下修改MySQL用户(root)密码的方法

    如何在Linux下修改Mysql的用户(root)密码

    主要介绍了如何在Linux下修改Mysql的用户(root)密码,分两种情况:第一种当拥有原来的mysql的root密码,第二种情况忘记原来的mysql的root的密码,需要的朋友可以参考下

    MySQL修改root密码.txt

    我们在使用Linux下搭建数据库往往会设置很繁琐忘记密码 接下教大家如何不需要密码修改

    linux下忘记mysql密码的几种找回方法(推荐)

    今天我们主要是讲一下关于linux忘记mysql密码处理方法,下面提供了5种linux忘记mysql密码找回方法哦。 方法一(先进入root权限): # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --...

    MySql8.0以上版本正确修改ROOT密码的方法

    部署环境: 安装版本red hat Cent 7.0 MYSQL 版本 8.0.2.0 成功部署完毕后出现故障情况: ...后进去刷新权限表,重启服务,不用密码的root进去,在改root密码后,重新刷新权限表。方法试了很多个都不

    Linux下mysql的root密码修改方法

    相信每位程序员们对mysql应该都再熟悉不过了,但是有时大脑短路,突然忘记mysql的超级用户root的密码,这个时候就要修改个新的密码了,下面这篇文章就介绍了Linux下mysql的root密码修改方法,一起来看看吧。

    mysql 8.0.16 winx64及Linux修改root用户密码 的方法

    连接数据库等基础操作请自行解决哈,本篇...默认root密码为空的话 ,下面使用navicat就无法连接(之前我装的5.7好像还可以),所以这里需要修改root的密码。 此乃关键一步。为此被坑了好长时间,后来查阅很多才知道在my

    linux下mysql的root密码忘记的解决方法

    五步轻松解决mysql root密码忘记的问题,希望对大家有帮助。 1.修改MySQL的登录设置: # vi /etc/my.cnf  在[mysqld]的段中加上一句,...3.登录并修改MySQL的root密码 # mysql mysql> USE mysql ; mysql> UPD

    解决Linux下Mysql5.7忘记密码问题

    linux下的mysql5.7忘记密码 二、解决 •第一步:打开mysql5.7的配置文件my.cnf,并在里面增加一行:skip-grant-tables 保存并退出(:wq) [root@iz09a32x1sghz3z ~]# vi /etc/my.cnf •第二步:重启mysql [root@iz09a...

    Linux使用MySQL忘记root密码及修改MySQL默认编码

    1.CentOS6.x下MySQL忘记root密码解决方法 Ⅰ. 修改MySQL的登录设置  # vim /etc/my.cnf 在[mysqld]段中加上一句:skip-grant-tables Ⅱ. 重启服务 # service mysqld restart Ⅲ. 登录Mysql,修改密码信息 # ...

    Mysql5.7忘记root密码怎么办(简单且有效方法)

    在上篇文章给大家介绍了Mysql5.7忘记root密码及mysql5.7修改root密码的方法 Mysql5.7忘记密码快速且简单的解决方法,具体方法详情如下所示: # 最简单最粗暴的方法 找到mysql的配置文件直接编辑 vim /etc/my.cnf #...

    linux MySQL.docx

    目录 Linux MySQL 1 一、linux系统自带MySQL问题 1 1、查看是linux是否自带MySQL 1 ...2、修改mysql root用户密码 9 五、允许远程访问MySQL 10 1、允许远程访问 10 2、允许可视化工具连接 11

    Linux mysql-5.6如何实现重置root密码

    2.修改mysql的配置文件my.conf 一般在/etc目录下,运行命令:vi /etc/my.cnf,编辑文件 在文件的[mysqld]标签下添加一句:skip-grant-tables 然后wq!保存退出。 3.重启数据库 运行命令:service mysqld start 4....

    在Linux环境下mysql的root密码忘记解决方法(三种)

    因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 状态下,其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对外的端口封闭,并且停止Apache以及所有的用户进程的方法实现...

    linux忘记mysql密码

    linux忘记mysql密码处理方法,下面提供了4种linux忘记mysql密码找回方法哦。  方法一:  # /etc/init.d/mysql stop  # mysqld_safe –user=mysql –skip-grant-tables –skip-networking &  # mysql -u root...

Global site tag (gtag.js) - Google Analytics