Child pages
  • How do I change a MySQL account password?

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Remote Account Password (phpMyAdmin) - If you are using the central SoIC MySQL server, db.soic.indiana.edu, then the easiest way is just to use the phpMyAdmin web Interface.  Just log in using your current MySQL username and password and then you can change the password by clicking the Change password link under General SettingsPLEASE NOTE that you will only be able to access this web interface while on the IU network or by using the IU VPN if you are connecting from outside of IU.

    Warning

    WARNING: If you use either of the following command line methods, please note that your new password will end up in your .mysql_history file.  You are urged to edit that file and remove the password change line after you change your password.

  2. Remote Account Password (command line) - From any of the SoIC linux systems (such as silo, tank, hulk, or any system other than the MySQL server itself) run the following.  You can use this procedure to change the password for a database hosted on db.soic.indiana.edu.

    Code Block
    none
    none
    $ mysql -h db.soic.indiana.edu -u db_username -p db_name
    Enter password: <enter the old remote password for the db_username account>
    ...
    mysql> set password for 'db_username'@'%' = PASSWORD('new_password');
    

    In this example, the MySQL server is db.soic.indiana.edu but you can change that to the appropriate server if you are not using the central SoIC MySQL server.  You will replace db_name with the name of the MySQL database, db_username with the MySQL account username, and new_password with the new password

     

  3. Local Account Password (command line) - If you are using a system other than db.soic.indiana.edu where you have a localhost database account, you can set the password as follows once you are logged into the MySQL server.  Please note that you will NOT need to, or be able to, do this for a database hosted on db.soic.indiana.edu.

    Code Block
    none
    none
    $ mysql -u db_username -p db_name
    Enter password: <enter the old local password for the db_username account>
    ...
    mysql> set password for 'db_username'@'localhost' = PASSWORD('new_password');
    

    In this example, you will replace db_name with the name of the MySQL database, db_username with the MySQL account username, and new_password with the new password.