How do i find mysql path?

Recently I installed MySQL server on my Debian machine using Advanced Packaging Tool, and I'm curious to know where it's installed and how I can find all the source files and user databases.

I've only been able to find the configuration at /etc/mysql, and to find some other small pieces using whereis command and find / -name "mysql", but besides that, nothing much exciting appears on screen.

How do i find mysql path?

asked Mar 30, 2014 at 19:58

1

Debian versions of MySQL packages store the MySQL data in /var/lib/mysql directory by default. You can see this in /etc/mysql/my.cnf file also.

Debian packages don't contain any source code, if that is what you meant by source files. Binaries are installed generally in /usr/bin and /usr/sbin directories.

You can see where the package files are installed by using dpkg -L <packagename> command. Note the capital L letter.

If you want to know the packet name for MySQL, you can use dpkg -l | grep mysql to view all packages that have mysql in their names.

answered Mar 30, 2014 at 20:01

4

If it's in your path, try one of these:

which mysql
which mysqld

Edit: InnoDB is now the default engine, and to find its data files, assuming the installation was correctly done, view the /etc/mysql/my.cnf file and look for the lines that contain innodb_data_home_dir and/or innodb_data_file_path.

answered Mar 30, 2014 at 20:09

How do i find mysql path?

2

You have global configuration file - /etc/myysql/my.cnf. Other variables are inside mysql database that is (along with others), in the following location: /var/lib/mysql/.

In fact, what you need is only binary mysql/mysqld/mysqladmin. If you really really wanted to see a whole list mysql server files, then:

  1. assuming you haven't cleaned anything on this machine...
  2. go to folder /var/cache/apt/archives
  3. if you have midnight commander installed (mc packet), then run it and...
  4. go to mentioned folder, search mysql-server file and press F3
  5. This will show you server package content
  6. Of course, there are also other packages (dependent) like mysql-common - look for strong Depends after F3 pressed on selected package.

jasonwryan

69k31 gold badges188 silver badges222 bronze badges

answered Mar 30, 2014 at 21:50

After downloading and installing MySQL 8.0.24 yesterday, I opened a command shell. In the command shell, I could access the MySQL Shell (mysqlsh.exe) but not the MySQL Client (mysql.exe). Typing in the following:

C:\WINDOWS\system32>mysql

It returned:

'mysql' is not recognized as an internal or external command,
operable program or batch file.

The MySQL Client (mysql.exe) was installed because MySQL Workbench relies on it. However, the MySQL Microsoft Software Installer (MSI) does not put the mysql.exe file’s directory in the common Windows %PATH% environment variable. You can find the required %PATH% directory variable by opening the File Manager and searching for the mysql.exe file.

You should return several directories and programs but the directory you want is:

C:\Program Files\MySQL\MySQL Server 8.0\bin

You can test it by using the SET command in the Microsoft Operating System, like this:

SET PATH=C:\Program Files\MySQL\MySQL Server 8.0\bin;%PATH%

You can now call the mysql.exe program in your current shell session with the following syntax:

You will be prompted for the password and then connected to the database as follows:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.24 MySQL Community Server - GPL
 
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql>

Unfortunately, the SET command only sets the %PATH% environment variable in the current session. You can set the system %PATH% environment variable globally by following these steps:

  1. In Search, search for and then select: System (Control Panel)
  2. In Settings dialog enter “Environment” in the search box and it will display:

    How do i find mysql path?

  3. Chose “Edit the system environment variables” option. You will see the following “System Properties” dialog:
  4. How do i find mysql path?

  5. Click the “Environment Variable” button to display the “Environment Variables” dialog. Click on the Path system variable before clicking the Edit button beneath.

    How do i find mysql path?

  6. Click the “New” button and enter “C:\Program Files\MySQL\MySQL Server 8.0\bin, and click the “OK” button. The next time you query the computer system’s %PATH% environment variable, it will show you the list of path locations that the operating system looks at for command files. It’s actually stored as a semicolon-delimited list in Windows 10 (and, as a colon-delimited list in Linux or Unix).

    How do i find mysql path?

  7. The next time you open a command shell, the %PATH% environment variable will find the mysql.exe program. As always, I hope these instructions help the reader.

How do I find MySQL path in Windows?

On the Windows desktop, right-click the My Computer icon, and select Properties. Next select the Advanced tab from the System Properties menu that appears, and click the Environment Variables button. Under System Variables, select Path, and then click the Edit button. The Edit System Variable dialogue should appear.

What is the default path for MySQL?

For MySQL 5.7 on Windows, the default installation directory is C:\Program Files\MySQL\MySQL Server 5.7 for installations performed with MySQL Installer. If you use the ZIP archive method to install MySQL, you may prefer to install in C:\mysql .

What is the file system path where MySQL is installed?

C:\Program Files\MySQL\MySQL Server 5.6\binClick the start toolbar. Right click “My Computer”