Display MySQL Variables with a PHP Tool
Download:
show-mysql-vars.zip
This article is about a tool that can be used to show the values of all your MySQL server system variables through a web browser. It can work even if you don’t have administrative access to your server. This tool can be used to help diagnose the problem described in one of my other articles.
Installing the Tool
- Download show-mysql-vars.zip
- Unzip the show-mysql-vars.php file from the zip archive.
- If you have WordPress, upload the show-mysql-vars.php file to the same directory as your wp-config.php file (root WordPress directory)
- This is helpful because the script will get your MySQL username and password from the wp-config.php file.
- If you don’t have WordPress, then upload it to any directory in your webserver that can execute PHP files.
Executing the Tool
- Open the file in your browser, i.e. http://www.example.com/wp/show-mysql-vars.php
- If you installed it in the same directory as your wp-config.php file, the MySQL variables should be displayed for you.
- If you don’t have WordPress or a wp-config.php file, you’ll be asked for your MySQL username and password. Enter that in and click “Submit”.
- I recommend to remove this PHP file from your server after you use it to increase security.
How it Works
The script essentially executes the MySQL query “show variables”, and prints out the results. It also executes the MySQL query “show status” and prints out those results too.
Alternatives
There are several alternative methods besides this PHP script:
- Use the phpMyAdmin utility if it is available to you.
- There should be a link in that utility titled “Show MySQL system variables”.
- If you have ssh access, you can use the “mysql” command.
shell prompt> mysql -u username -ppassword mysql> show variables;
- If you have ssh access, you can use the “mysqladmin” command.
shell prompt> mysqladmin -u username -ppassword variables
Comments Off on Display MySQL Variables with a PHP Tool
No Comments
No comments yet.
RSS feed for comments on this post.
Sorry, the comment form is closed at this time.