Method: 1. Use the "show variables like '�sedir%';" command to query the basic installation path of the file; 2. Use the "show variables Like '�tadir%';" command to query the path of the database data.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How does mysql query the path
Sometimes we don’t necessarily remember the installation path of the database during our development process. For example, to check where the installation directory of the mysql database is:
We can check the installation path of mysql through the mysql command:
# Either of the following two sql 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 the database data. It is very simple. Just replace the above parameter variable with datadir:
# The following queries are arbitrary Either one can be used
select @@datadir as dataPath from dual ; show variables Like '%datadir%';
Of course, the above is based on being able to log in to the mysql window to view it, so friends will ask, if you don’t know the account password to log in to mysql, then what? How to check the mysql path?
Method 1:
1: Query the path of the running file
which mysql##Then you can use /usr/bin/mysql -u account -p password to connect to Mysql: Then execute any of the above MySQL to view the installation path. Is this very cumbersome? There is also a simpler method Method 2: Check the installation information of mysql:
ps -ef | grep mysql
##Red The specific paths are marked.
Recommended learning:
mysql video tutorialThe above is the detailed content of How to query the path in mysql. For more information, please follow other related articles on the PHP Chinese website!