Skip to content

Instantly share code, notes, and snippets.

@Williammer
Created May 17, 2014 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Williammer/4e0fb806f6b741b0964d to your computer and use it in GitHub Desktop.
Save Williammer/4e0fb806f6b741b0964d to your computer and use it in GitHub Desktop.
mysql configurations - processes to configure mysql
1.Start the mysql server instance or daemon with the --skip-grant-tables option. (security setting)
$ mysqld --skip-grant-tables
2.Then Execute these statements.
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;
3.Finally, restart the instance/daemon without the --skip-grant-tables option.
$ /etc/init.d/mysql restart
4.You should be able to connect with your new password.
$ mysql -u root -p
Enter password: my_password
/********** add login requirement in phpmyadmin *********/
change auth_type from 'config' to 'http':
$cfg['Servers'][$i]['auth_type'] = 'http';
/***** config db ****/
To log in you MUST use the password once it is set. You need to be entirely sure it is correct as you can NEVER access the database again if you enter it incorrectly. You should NEVER try to run the database admin as root, so you should have created a new user to run it and given that user full (including grant) access. So if you can't get into that account because of a wrong password you could have used root to fix it. Then you test that user and after that you set the password for root and never use root again. Unless you have direct access to the files in mysql to remove the actual mysql folder and then restart the server you have effectively locked yourself out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment