Home  >  Article  >  Database  >  How to query the path in mysql

How to query the path in mysql

WBOY
WBOYOriginal
2022-01-12 11:30:2310249browse

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.

How to query the path in mysql

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%';

How to query the path in mysql

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%';

How to query the path in mysql

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

How to query the path in mysql

##Then you can use /usr/bin/mysql -u account -p password to connect to Mysql:

How to query the path in 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

How to query the path in mysql##Red The specific paths are marked.

Recommended learning:

mysql video tutorial

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to modify mysql timeNext article:How to modify mysql time