Fueling Your Coding Mojo

Buckle up, fellow PHP enthusiast! We're loading up the rocket fuel for your coding adventures...

Popular Searches:

php - #1193 - Unknown system variable 'lc_messages' when trying to login to phpmyadmin

I recently encountered an issue when trying to login to phpMyAdmin. Whenever I attempt to log in, I receive the following error message: "php#1193 - Unknown system variable 'lc_messages'". This error completely blocks me from accessing my database and performing any necessary tasks.

I have been using phpMyAdmin for quite some time without any issues, so this problem came as a surprise. I have not made any recent changes to my setup or configuration, which makes it even more puzzling.

I am using PHP version 7.4.3 and MySQL version 5.7.28 on a CentOS 7 server. I have tried restarting both PHP and MySQL services, but the error remains. I also checked my MySQL configuration file to see if there was any mention of 'lc_messages', but I couldn't find anything.

I have searched online for possible solutions or similar cases, but so far, I haven't come across anything specific to this error. Most of the troubleshooting guides I found were about other phpMyAdmin login issues, not related to this particular 'lc_messages' error.

Can anyone shed some light on what might be causing this problem and how I can go about resolving it? I would greatly appreciate any assistance or guidance in resolving this issue. Thank you in advance!

All Replies


User 2:
I had a similar frustrating experience with the 'lc_messages' error in phpMyAdmin, and it took me a while to troubleshoot it. After experimenting with different solutions, here's what eventually resolved the issue for me:

1. Locate your MySQL configuration file. On my CentOS server, it was located at `/etc/my.cnf`, but in some cases, it might be located at `/etc/mysql/my.cnf` or another directory.

2. Open the configuration file using a text editor.

3. Look for the `[mysqld]` section within the file. If the section doesn't exist, you can add it at the end of the file.

4. In the `[mysqld]` section, add or modify the following line:
`init_connect='SET collation_connection = utf8_general_ci'`

This line sets the collation connection value to 'utf8_general_ci'. You can adjust this value based on your preferred collation.

5. Save the changes and close the file.

6. Restart the MySQL service to apply the configuration changes. Use the command:
`sudo systemctl restart mysqld`

Now, try accessing phpMyAdmin again. This solution worked for me, and the 'lc_messages' error was no longer present.

I hope this solution works for you too. If you come across any further issues or if you need additional assistance, feel free to ask. Good luck!


User 1:
I had a similar issue with phpMyAdmin and the 'lc_messages' variable. In my case, the problem was related to the MySQL server configuration. Here's what I did to resolve the issue:

1. Open the MySQL configuration file using your preferred text editor. Usually, it is located at `/etc/my.cnf` or `/etc/mysql/my.cnf`.

2. Look for the `[mysqld]` section in the configuration file. If it doesn't exist, add it at the end of the file.

3. Within the `[mysqld]` section, add the following line:
`lc-messages = en_US`

This sets the 'lc-messages' variable to the English language. You can specify a different language if preferred.

4. Save the changes and exit the text editor.

5. Restart the MySQL service for the changes to take effect. On CentOS, you can do this by running the command:
`sudo systemctl restart mysqld`

6. Now try accessing phpMyAdmin again and see if the 'lc_messages' error still occurs.

In my case, after applying these steps, the error disappeared, and I was able to log in to phpMyAdmin without any issues. Hopefully, this solution works for you too. Give it a try and let us know if you encounter any further problems or if there's anything else we can assist you with.


User 3:
I also encountered the dreaded 'lc_messages' error when I tried logging in to phpMyAdmin. It was quite frustrating, but I managed to resolve it by taking a slightly different approach. Here's what worked for me:

1. Check if your MySQL server version is compatible with your phpMyAdmin version. In some cases, this error can occur due to version incompatibility. Ensure that they are compatible and update either of them if necessary.

2. If you're using a customized my.cnf file, make sure there are no conflicting configurations. Incorrect configurations can often lead to the 'lc_messages' error. Double-check your my.cnf file and remove or modify any conflicting settings.

3. Another potential cause can be related to the MySQL client libraries on your server. Ensure that you have the latest MySQL client libraries installed. If not, try updating them and check if the error persists.

4. Clear your browser cache and cookies. Sometimes, stored cache or outdated cookies can interfere with logging into phpMyAdmin. Clearing them might help eliminate any related issues.

5. If you have access to the MySQL server command line, try running the following command:
`SET lc_messages = 'en_US';`

This explicitly sets the 'lc_messages' variable to English. Replace 'en_US' with your preferred locale if needed.

6. Finally, restart both the MySQL and web server services to apply any changes made throughout the troubleshooting process.

By following these steps, I managed to get rid of the 'lc_messages' error and successfully logged in to phpMyAdmin. I hope this helps you as well. If you have any further questions or encounter any other difficulties, don't hesitate to ask. Good luck!

New to LearnPHP.org Community?

Join the community