Change and Reset MySQL root Password改变和重置MySQL的root密码

Other then the ways specified然后其他的方式指定 here这里 to reset and change the root password for mySQL database in the case that the password is forgotten or lost, the following instructions explain in details the alternative way at the last part of the guide, where no additional file needs to be created:重置和改变了root密码为MySQL数据库,在案件的密码是忘记或遗失,下列指示解释,在细节的替代方式,在最后部分的指导,如果没有额外的文件需要创建:

  1. Login as root to the Windows or Unix-like (Unix, Linux or BSD) machine with the MySQL server.以root身份登录到Windows或Unix一样(的Unix , Linux或BSD的)机器与MySQL服务器。
  2. Stop the MySQL server by using either of the following command:停止MySQL服务器使用的下列命令:

    Linux: /etc/rc.d/init.d/mysql stop Linux作业系统:在/ etc / rc.d / init.d /的MySQL的停止
    FreeBSD: /usr/local/etc/rc.d/mysql-server.sh stop FreeBSD作业系统:在/ usr / local的/ etc / rc.d / MySQL的- server.sh停止

  3. Open the mysql server startup script (ie mysql-server.sh - the file executed to start or stop MySQL server.打开MySQL服务器启动脚本(即MySQL的- server.sh -该文件执行的开始或停止M ySQL服务器。
  4. Add –skip-grant-tables to the end of the line that contains the mysqld_safe command as its parameter.添加-跳过-赠款表到去年底,该行包含mysqld_safe命令作为参数。
  5. Start MySQL server with the following command:启动MySQL服务器与下面的命令:

    Linux: /etc/rc.d/init.d/mysql start Linux作业系统:在/ etc / rc.d / init.d /的MySQL的开始
    FreeBSD: /usr/local/etc/rc.d/mysql-server.sh start FreeBSD作业系统:在/ usr / local的/ etc / rc.d / MySQL的- server.sh开始

  6. Alternatively, start the MySQL server directly and skip the editing with the following command:或者,启动MySQL服务器直接跳到编辑与以下命令:

    mysqld_safe –skip-grant-tables & mysqld_safe -跳过-赠款表&

    Depending on your path environment, you may need to point to the correct directory where mysqld_safe is instead.根据您的PATH环境,您可能需要指向正确的目录下mysqld_safe是不是。

  7. Run the following commands to login as the mysql user and connect to mysql user/permission database:运行下面的命令登录作为MySQL用户并连接到MySQL用户/许可数据库:

    # mysql -u root mysql # MySQL的中美根的MySQL

  8. Run the update queries to change the MySQL password:运行更新查询来改变MySQL的密码:

    mysql> UPDATE user SET Password=PASSWORD(’newrootpassword’) WHERE User=’root’; MySQL的>更新用户设置密码=密码( ' newrootpassword ' )其中user = '根' ;
    mysql> FLUSH PRIVILEGES; MySQL的>冲水特权;

    Note: Replace newrootpassword with the new root password for MySQL server.注:取代newrootpassword与新的root密码为MySQL服务器。 Flush Privileges is needed to making the password change effect immediately.冲水特权,是需要作出更改密码立即生效。

  9. Exit mysql database client by typing exit.退出MySQL数据库的客户端上键入exit 。
  10. Stop MySQL server with commands listed at step 2.停止MySQL服务器与命令列在第2步。
  11. Open the mysql server startup script edit in step 3 again and remove the –skip-grant-tables parameter that has been added.打开MySQL服务器启动脚本编辑在第3步,再删除-跳过-赠款表参数已添加。
  12. Start MySQL server by using command from step 5 or 6.启动MySQL服务器使用命令从步骤5或6 。

For Redhat Linux users, use the following instructions as the root user of Redhat Linux machine:为Redhat的Linux用户,请使用以下的指示,作为root用户的版RedHat Linux的机:

  1. Stop MySQL process by using command:停止MySQL的过程中所使用的命令:

    # killall mysqld # killall mysqld

  2. Start the MySQL server with following options:启动MySQL服务器与下列选项:

    # /usr/libexec/mysqld -Sg –user=root & #是/ usr / libexec / mysqld -双桂用户=根&

  3. Start the MySQL client:启动MySQL客户端:

    # mysql # MySQL的

    You should see the following message:你应该看到以下讯息:

    Welcome to the MySQL monitor.欢迎您到MySQL的监察。 Commands end with ; or g.命令结束;或g.
    Your MySQL connection id is 1 to server version: 3.xx.xx您的MySQL连接ID是1至服务器版本: 3.xx.xx

    Type ‘help;’ or ‘h’ for help.键入'帮助; '或' h '的帮助。 Type ‘c’ to clear the buffer.类型的' C ' ,以清除缓冲区。

    mysql> MySQL的>

  4. Use mysql database:使用MySQL数据库:

    mysql> USE mysql MySQL的>中使用MySQL

    You should see the following message:你应该看到以下讯息:

    Reading table information for completion of table and column names读表信息,为完成表和列名
    You can turn off this feature to get a quicker startup with -A您可以关闭此功能,以获得更快的启动与- 1

    Database changed数据库改变

  5. Then, update the password for the root user with the following command:然后,更新密码,为root用户与下列命令:

    UPDATE user SET password=password(”newpassword”) WHERE user=”root”;更新用户设置密码=密码( “ newpassword ” )凡用户= “根” ;

    Replace newpassword with your desired password.取代newpassword与您想要的密码。 You should see the following message:你应该看到以下讯息:

    Query OK, 2 rows affected (0.03 sec)查询确定,二行的影响( 0.03秒)
    Rows matched: 2 Changed: 2 Warnings: 0行匹配: 2改变: 2警告: 0

    Rows affected may be different, but the Query OK should be there.行受影响的可能有所不同,但查询确定,应该有。

  6. Flush the database privileges to reload it in order to make the changes effective:刷新数据库的特权,重新载入它,以使有效的变化:

    mysql> flush privileges; MySQL的>冲水特权;

    You should get the following result:你应得的结果如下:

    Query OK, 0 rows affected (0.02 sec)查询确定, 0行受影响( 0.02秒)

  7. Exit the MySQL client by typing exit.退出MySQL客户端上键入exit 。
  8. Kill the MySQL server process by typing killall mysqld.杀死MySQL服务器的过程中输入killall mysqld 。
  9. Then start MySQL again:然后启动MySQL的再次:

    /etc/init.d/mysqld start / etc / init.d /的mysqld启动

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 .



6 Responses to “Change and Reset MySQL root Password” 6反应“的变化和重置MySQL的root密码”

  1. Reset the Root Password of MySQL Server » My Digital Life重置root密码的MySQL服务器»我的数位生活
    June 6th, 2006 18:18 2006年6月6日18时18分
    1

    [...] Alternatively, on any platform, mysql client can be used to set the new password, althought it’s less secure way of resetting the password (detailed instruction here): [...] [ … … ]另外,任何平台上, MySQL客户端可以用来设置新的密码,虽然它的安全性较低的方式重设密码(详细指示,在这里) : [ … … ]

  2. Vincitore vincitore
    July 9th, 2006 12:05 2006年7月9日12时05分
    2

    I wanna reset my ZXDSL 831 ADSL Modemn我想重设我的zxdsl 831的ADSL modemn
    Plz tell me the way how to reset it plz告诉我如何重置
    I need to do that right now我需要这样做的权利,现在

    Best Rgds最佳rgds
    dugger(vincitore) dugger ( vincitore )

  3. Help me retrieve my password - Geeks Talk帮我找回我的密码-同好谈
    December 19th, 2006 14:54 2006年12月19日14时54分
    3

    [...] Re: Help me retrieve my password Try this link… Change and Reset MySQL root Password [ … … ]回复:帮我找回我的密码尝试此连结…变化和重置MySQL的root密码

  4. links for 2007-04-23 | Patrick Kempf链接2007年4月23日|帕特里克坎普弗
    April 23rd, 2007 08:23 2007年4月23日8时23分
    4

    [...] Change and Reset MySQL root Password » My Digital Life (tags: mysql administration) No Tags Gelesen: 2 / heute: 2 [...] [ … … ]的变化和重置MySQL的root密码»我的数位生活(标签: MySQL的政府)没有标签gelesen : 2 / heute : 2 [ … … ]

  5. Mengubah password root pada MySQL 5.0 di Windows. mengubah密码根pada MySQL 5.0的直接投资的Windows 。 « Iwan Binanto: “hari-hari ku yang berlalu ..” «伊万binanto : “哈-哈古杨berlalu .. ”
    May 5th, 2008 16:52 2008年5月5日16时52分
    5

    [...] judulnya), setelah googling cuma dapat cara untuk mereset dan mengganti password MySQL di UNIX-like di sini. [ … … ] judulnya ) , setelah使用Google cuma应该象限定mereset丹mengganti密码MySQL的直接投资的UNIX一样,邸四逆。 Wah, perlu sedikit modifikasi ni … Berikut cara2 yang saya lakukan: 1.议员, perlu sedikit modifikasi倪… berikut cara2杨saya lakukan : 1 。 Kill proses MySQL [...]杀死散文MySQL的[ … … ]

  6. Rajesh Cheethirala rajesh cheethirala
    July 3rd, 2008 05:46 2008年7月3日5时46分
    6

    On ubuntu, command is mysqld_safe –-skip-grant-tables &关于Ubuntu的,指挥是mysqld_safe -跳过-赠款表&

    Extra dash is required so mysql can parse it correctly.短跑是额外的要求,以便MySQL的可以解析正确的。

Leave a Reply离开的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用这些标签:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <删除日期时间= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting订阅无评论


Custom Search

New Articles新的条款,

Incoming Search Terms for the Article传入的搜索条件文章

change mysql root password 改变MySQL的root密码 - - mysql change root password MySQL的改变root密码 - - mysql change password MySQL中修改密码 - - reset mysql password 重置MySQL的密码 - - reset mysql root password 重置MySQL的root密码 - - mysql password change MySQL的密码变更 - - mysql password reset MySQL的密码重置 - - mysql password recovery MySQL的密码恢复 - - change root password mysql 改变root密码的MySQL - - change password mysql 更改密码的MySQL - - retrieve mysql root password 检索MySQL的root密码 - - forgot mysql password 忘了MySQL的密码 - - mysql root password change MySQL的root密码变更 - - mysql root password reset MySQL的root密码重置 - - reset mysql password ubuntu 重置MySQL的密码Ubuntu的 - - reset mysql root pass 重置MySQL的根通过 - - mysql retrieve root password MySQL的检索root密码 - - ubuntu stop mysql Ubuntu的停止MySQL的 - - change password in mysql 变更密码在MySQL - - mysql reset root pass MySQL的重置根通过 - - How to change Mysql root password 如何改变MySQL的root密码 - - change mysql password ubuntu 改变MySQL的密码Ubuntu的 - - CHANGE MYSQL PASSWORD 改变MySQL的密码 - - how to reset mysql password 如何重置MySQL的密码 - - mysql reset privileges MySQL的重置特权 - - ubuntu reset mysql root password Ubuntu的重置MySQL的root密码 - - ubuntu reset mysql password Ubuntu的重置MySQL的密码 - - how to change password in mysql 如何更改密码在MySQL - - mysql ubuntu default password MySQL的Ubuntu的默认密码 - - retrieve mysql password 检索MySQL的密码 - - mysql reset password MySQL的重设密码 - - ubuntu mysql reset password Ubuntu的MySQL的重设密码 - - reset mysql root password ubuntu 重置MySQL的root密码Ubuntu的 - - crack mysql password 裂纹MySQL的密码 - - reset mysql password linux 重置MySQL的密码的Linux - - forgot mysql root password 忘了MySQL的root密码 - - reset mysql pass 重置MySQL的通行证 - - all 全部 - - reset password mysql 重设密码的MySQL - - stop mysql ubuntu 停止MySQL的Ubuntu的 - - ubuntu change mysql password Ubuntu的改变MySQL的密码 - - ubuntu mysql change password Ubuntu的MySQL的更改密码 - - mysql set password MySQL的设置密码 - - mysql lost password MySQL的遗失密码 - - mysql forgot password MySQL的忘记密码 - - mysql reset password linux MySQL的重设密码的Linux - - mysql reset root MySQL的重置根 - - changing mysql root password 改变MySQL的root密码 - - how to reset mysql root password 如何重置MySQL的root密码 - - ubuntu mysql default password Ubuntu的MySQL的默认密码 - - mysql forgot root password MySQL的忘记了root密码 - - mysql change password root MySQL中修改密码根 - - ubuntu mysql set root password Ubuntu的设置MySQL的root密码 - - mysql "change password" MySQL的“更改密码” - - lost mysql password 失去了MySQL的密码 - - mysql change root pass MySQL的变更根通过 - - mysql root change password MySQL的根变更密码 - - ubuntu mysql reset root password Ubuntu的重置MySQL的root密码 - - resetting mysql password 重置MySQL的密码 - - mysql reset root password MySQL的root密码重置 - - change password mysql ubuntu 更改密码MySQL的Ubuntu的 - - change mysql root pass 改变MySQL的根通过 - - change mysql password linux 改变的MySQL密码的Linux - - mysql clear password MySQL的明确的密码 - - mysql password MySQL的密码 - - mysql lost root password windows MySQL中失去了root密码的Windows - - mysql reset user MySQL的重置用户 - - set mysql password 设置MySQL的密码 - - set password mysql 设置密码的MySQL - - ubuntu mysql password Ubuntu的MySQL的密码 - - lost mysql password ubuntu 失去了MySQL的密码Ubuntu的 - - linux mysql reset password Linux的MySQL的重设密码 - - reset mysql database password 重置MySQL数据库的密码 - - retrieve lost mysql password 找回失去的MySQL密码 - - linux reset mysql password Linux的重置MySQL的密码 - -