How to view the database installation path in MySQL

How to view the database installation path in MySQL

We can view the installation path of mysql through the mysql command:

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

The basic installation path can be seen above. To check the path of the database data, it is very simple. Just replace the above parameter variable with 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 being able to log in to the MySQL window to view it. Then 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 of the above MySQL to view the installation path. Is this too complicated? It can be simpler.

Method 2:

View the installation information of mysql:

ps -ef | grep mysql

The red mark shows the specific path.

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

<<:  H tags should be used reasonably in web page production

>>:  Quickjs encapsulates JavaScript sandbox details

Recommend

Implementation of Nginx domain name forwarding

Introduction to Nginx Nginx ("engine x"...

Analysis of the principle of Nginx using Lua module to implement WAF

Table of contents 1. Background of WAF 2. What is...

Examples of common Nginx misconfigurations

Table of contents Missing root location Off-By-Sl...

Vue project implements file download progress bar function

There are two common ways to download files in da...

How to solve the Docker container startup failure

Question: After the computer restarts, the mysql ...

In-depth analysis of MySQL data type DECIMAL

Preface: When we need to store decimals and have ...

Detailed explanation of Docker Swarm concepts and usage

Docker Swarm is a container cluster management se...

What is TypeScript?

Table of contents 1. JavaScript issues 2. Advanta...

Mysql string interception and obtaining data in the specified string

Preface: I encountered a requirement to extract s...

HTML table markup tutorial (28): cell border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

Detailed steps for deploying Tomcat server based on IDEA

Table of contents Introduction Step 1 Step 2: Cre...

Detailed explanation of docker-machine usage

Docker-machine is a Docker management tool offici...

Simple implementation method of two-way data binding in js project

Table of contents Preface Publish-Subscriber Patt...

How to unify the character set on an existing mysql database

Preface In the database, some data tables and dat...