HomeLinuxDiscover Your MySQL Knowledge Listing Containing Your Retain Database

Discover Your MySQL Knowledge Listing Containing Your Retain Database


The MySQL information listing is the place the databases are saved together with its retain database. The retain database shops the header information and tips to databases and information on the disk. Whereas working in MySQL, typically the info administrator needs to seek out the situation of the info listing containing the system’s retain database to carry out varied administrative duties.

This publish will focus on discovering the MySQL information listing containing the retain listing in Home windows and Linux.

Pre-requisite: Login to MySQL Server

Be certain that to log in to the MySQL server, for that open the command immediate and use this syntax to login to your native MySQL server:

Present the username of MySQL server within the syntax to kind the command and run it to log in to your MySQL server efficiently:

Discover MySQL Knowledge Listing Containing Retain Database Utilizing “SELECT” Command

The “SELECT” command can be utilized to find the info listing containing the retained database on Home windows and Linux working methods. Let’s run the given under command on Home windows:

The output will show the folder location that comprises the retain database:

On Linux, the command is identical to seek out the info listing containing retain databases, run this command after logging in MySQL server:

The output shows the situation of the info listing efficiently.

Discover MySQL Knowledge Listing Containing Retain Database Utilizing “SHOW VARIABLE” Command

The “SHOW VARIABLE” command shows the names and values of system variables. The command to seek out the info listing containing retain databases is identical for Home windows and Linux. The command is given under:

SHOW VARIABLES LIKE ‘datadir’;

Run the command in Home windows, and the output will show the situation of the info listing, and for this publish, it’s positioned within the “C” drive:

Run the identical command in Linux to acquire the info listing location containing retain databases:

You could have efficiently positioned the info listing utilizing the “SHOW VARIABLE” command in Linux and Home windows.

Discover MySQL Knowledge Listing Containing Retain Database Utilizing “SHOW VARIABLE” Command with “WHERE” Clause

The “WHERE” clause can be utilized within the “SHOW VARIABLE” command to specify a sample within the “Variable_Name”.

Let’s see an instance of utilizing the “SHOW VARIABLE” command with a selected sample that title ought to begin with the string “information” and might comprise zero, single or a number of phrases after the string. The command is given under on Home windows and Linux each:

SHOW VARIABLES WHERE Variable_Name LIKE “information%”;

The Home windows will show this output:

When you’ll run the identical command on Linux, the output will present the info listing of Linux containing the retained databases:

One other instance could possibly be when the person can specify the sample that ends with “dir”. The given under command can run on Home windows and Linux. It can present all of the system variables whose names finish with “dir”:

SHOW VARIABLES WHERE Variable_Name LIKE “%dir” ;

On Home windows, the output displayed “13” rows of variable names, find for “datadir” to seek out the situation of information listing:

On Linux, the output will show the checklist of variable names, find the “datadir”:

SHOW VARIABLES WHERE Variable_Name LIKE “%dir” ;

You could have efficiently positioned the MySQL information listing containing the retained database in Home windows and Linux utilizing the “SHOW VARIABLE” command with the “WHERE” clause.

Alternatively, if the person doesn’t wish to log in after which run the instructions supplied above. This syntax can be utilized on the terminal of Home windows and Linux to seek out the situation of the info listing containing retain database:

mysql -u <username> -p -e “SHOW VARIABLES LIKE ‘datadir’;”

In Home windows Command Immediate, be certain to offer the username within the syntax and run the command:

The folder containing the retain database is seen within the output above.

Within the Linux terminal run the command by offering the username of MySQL and run the command:

You could have efficiently positioned the info listing containing retain a database.

Conclusion

In Linux and Home windows, to seek out MySQL information listing containing the retain database. Login to MySQL server and run the “choose @@datadir;” or “SHOW VARIABLES LIKE ‘datadir’;” command. Alternatively, run the “mysql -u <username> -p -e “SHOW VARIABLES LIKE ‘datadir’;” command. This publish mentioned discover the MySQL information listing containing the retain database.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments