One of my clients, Justin Williams, is a blogger. He owns a website named TheDehumidifierExperts which is all about dehumidifier reviews of all types, including both large dehumidifiers for household use and small dehumidifiers for closets. The website is powered by WordPress CMS and he encountered an error when trying to install PHPMyAdmin. He contacted us and we have tried our best to solve his problem.
When installing PHPMyAdmin you may get an extension missing error and not connect to MySQL database.
Error missing MySQLi when running PHPMyAdmin
When running PHPMyAdmin for the first time, you may get the following error "The MySQLi extension is missing. Please check your PHP configuration ......." This error means that during PHP installation we have not installed modules mysqli.so and mysql.so. To check which modules are installed, using the following command:# rpm -qa | grep -i phpWhen running this command you should at least see the following modules:
- PHP
- php-mysql
- php-common
- php-cli
#yum install php-mysqlNote depending on yum's database that it will install the latest version of php-mysql. However, if this module is not the same version as the existing PHP version, you will encounter php-common conflict error. So you may have to use the install command with the full version name like so.
#yum install php53-mysqlThen remember to restart apache with the following command:
#service httpd restart
PHPMyAdmin login error
After installing all the modules above, you can run PHPMyAdmin. However, in some cases, you will get the error that you cannot log in even if you type any username, password. The problem is that as soon as MySQL was installed, there were two users available, root and anonymous, and neither of them had passwords. You can log in from localhost by typing the following command# mysql -u rootHowever, you cannot log in from PHPMyAdmin because in PHPMyAdmin's config.inc.php file you will find the following line prohibiting login with non-users. password. Now we will use the command in centos to login to MySQL:
# mysql -u rootAlternatively, if you are familiar with the MySQL command, you can use the UPDATE mysql.user SET Password = PASSWORD command WHERE User = "root" to change the password with a single command. Finally, use the following command to update the above changes.
mysql> FLUSH PRIVILEGES;Now you can enter PHPMyAdmin with the password you just created above.
Security Note:
After entering PHPMyAdmin, you should immediately drop anonymous users and delete the database test to cover the vulnerabilities that hackers can penetrate the database. If PHPMyAdmin does not support drop user command and delete database command, you can use commands directly at mysql> prompt as follows:DELETE FROM mysql.user WHERE Password = ""; DELETE FROM mysql.db WHERE Db LIKE "test%"; mysql> DROP DATABASE test; FLUSH PRIVILEGES;