How to check the installation location of mysql: 1. Execute the "show variables like '�sedir%';" command in the mysql command line and view the output results; 2. Execute "ps - directly in the terminal ef | grep mysql" command to view the output results.
The operating environment of this tutorial: linux5.9.8 system, mysql8 version, Dell G3 computer.
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:
# 以下两个sql任意一个可查询 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:
# 以下查询任意一个均可 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 it before you can operate it, 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 of the running file
which mysql
Then you can pass /usr/bin/mysql -u account -p
Enter the password and connect to Mysql:
Then execute any of the above MySQL to view the installation path. Is this very cumbersome? There is a simpler method
Method 2:
View the installation information of mysql:
ps -ef | grep mysql
You can see the specific path marked in red.
[Related recommendations: mysql video tutorial]
The above is the detailed content of How to check the mysql installation location. For more information, please follow other related articles on the PHP Chinese website!