Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1003 Bytes

changing-forgotten-mysql-root-password.md

File metadata and controls

53 lines (36 loc) · 1003 Bytes
copyright lastupdated keywords subcollection
years
2014, 2023
2017-11-10
mysql password
database-tools

{{site.data.keyword.attribute-definition-list}}

Changing a forgotten MySQL root password

{: #dbt-change-mysql-password}

To change the {{site.data.keyword.mysql}} root password, use the following steps:

  1. Run the following commands:

    # /etc/init.d/mysqld stop
    

    {: pre}

    # mysqld_safe --skip-grant-tables --skip-networking
    

    {: pre}

  2. Connect to {{site.data.keyword.mysql}} with the following command:

    # mysql -u root
    

    {: pre}

  3. Run the following command in the {{site.data.keyword.mysql}} client:

    # UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';
    

    {: pre}

  4. Replace newpassword with your new root password.

  5. Restart the {{site.data.keyword.mysql}} server by using the following command:

    # /etc/init.d/mysqld start
    

    {: pre}