Instructions for Handling Errors of MySQL and PHPMyAdmin

,

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 php

When running this command you should at least see the following modules:

  • PHP
  • php-mysql
  • php-common
  • php-cli

If there is no php-mysql and php-mysqli, you will definitely get an error like the above while running PHPMyAdmin.

To install these modules use the command

#yum install php-mysql

Note 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-mysql

Then 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 root

However, 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 root

Alternatively, 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;

The post Instructions for Handling Errors of MySQL and PHPMyAdmin appeared first on RealSQLGuy.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

Share

Share

Rate