Method of viewing database installation path in MySQL


You can view the MySQL installation path through the MySQL command:

#Either of the following two SQL statements can be queried
select @@basedir as basePath from dual ;
show variables like '%basedir%';

You can see the basic installation path above. Check the path of database data. It is very simple to change the above parameter variable to dataDir:

#Any of the following queries can be used
select @@datadir as dataPath from dual ;
show variables Like '%datadir%';

Of course, the above is based on the fact that you can log in to the MySQL window to view. Friends will ask, if you don’t know the account password to log in to MySQL, how can you view the MySQL path?

Method 1:

1: Query the path where the running file is located

which mysql

Then you can connect to MySQL through / usr / bin / MySQL – U account – P password:

Then execute any MySQL above to view the installation path. Is this very cumbersome and simpler

Method 2:

View MySQL installation information:

ps -ef | grep mysql

The specific path can be seen in the red mark.

This is the end of this article on how to view the database installation path in MySQL. For more information about the MySQL database installation path, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!