1 05 2011

设置 / 更改 / 重置 MySQL root 密码 Ubuntu Linux

bigCat Posted in Linux, PHP - Comment.isBlank

http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/\r\n\r\n \r\n\r\nTested on\r\n- Ubuntu Linux 7.10 Gutsy Gibbon and MySQL 5.0.45. (2007-10-21)\r\n- Ubuntu Linux 6.06 Dapper Drake and MySQL 4.1.15.\r\n\r\nSet / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.\r\n

    \r\n
  1. Stop the MySQL Server.\r\n
    sudo /etc/init.d/mysql stop

    \r\n

  2. \r\n

  3. Start the mysqld configuration.\r\n
    sudo mysqld --skip-grant-tables &

    \r\n

  4. \r\n

  5. Login to MySQL as root.\r\n
    mysql -u root mysql

    \r\n

  6. \r\n

  7. Replace YOURNEWPASSWORD with your new password!\r\n
    UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

    \r\n

  8. \r\n

\r\nNote: This method is not regarded as the securest way of resetting the password. However it works.\r\n\r\n\r\nReferences\r\n\r\nMySQL 5.0 Reference Manual: How to Reset the Root Password

Host: (miao) | Word: Press | Code: HTML5