-
-
Save mayeenulislam/7f51d1a3068568fd170e to your computer and use it in GitHub Desktop.
Change mySQL password without SQL manager or PHPmyAdmin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Connect to mySQL First | |
$connection = mysql_connect('DB_HOST','DB_USER','DB_PASSWORD'); | |
//Select Database | |
mysql_select_db('DB_NAME'); | |
//Reset password with SQL UPDATE Query | |
$SQL="update wp_users set user_pass=MD5('newpassword123here') where user_login='admin'"; | |
//If everything's OK, your password will be reset | |
if(mysql_query($SQL)){ | |
echo "Your password was succesfully reset!"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Connect to mySQL First | |
$connection = mysql_connect('127.0.0.1','user_123','password_123'); | |
//Select Database | |
mysql_select_db('database_123'); | |
//Reset password with SQL UPDATE Query | |
$SQL="update wp_users set user_pass=MD5('newpassword123here') where user_login='admin'"; | |
//If everything's OK, your password will be reset | |
if(mysql_query($SQL)){ | |
echo "Your password was succesfully reset!"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ** MySQL settings - You can get this info from your web host ** // | |
/** The name of the database for WordPress */ | |
define('DB_NAME', 'database_123'); | |
/** MySQL database username */ | |
define('DB_USER', 'user_123'); | |
/** MySQL database password */ | |
define('DB_PASSWORD', 'password_123'); | |
/** MySQL hostname */ | |
define('DB_HOST', '127.0.0.1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment