Home > Database > Mysql Tutorial > How to check the mysql installation location

How to check the mysql installation location

青灯夜游
Release: 2022-01-05 16:44:30
Original
28690 people have browsed it

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.

How to check the mysql installation location

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%';
Copy after login

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%';
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
Statement of this Website
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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template