Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view the installation path of MySQL under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to view the installation path of MySQL under Linux". In the daily operation, I believe that many people have doubts about how to view the installation path of MySQL under Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to view the installation path of MySQL under Linux". Next, please follow the editor to study!

Check whether mysql and apache are installed and uninstalled under Linux.

Command ps-ef | grep-I mysql to get the result

Root 17659 10 2011? 00:00:00 / bin/sh / usr/bin/mysqld_safe-datadir=/var/lib/mysql-socket=/var/lib/mysql/mysql.sock-log-error=/var/log/mysqld.log-pid-file=/var/run/mysqld/mysqld.pid

Mysql 17719 17659 0 2011? 03:14:57 / usr/libexec/mysqld-basedir=/usr-datadir=/var/lib/mysql-user=mysql-pid-file=/var/run/mysqld/mysqld.pid-skip-external-locking-socket=/var/lib/mysql/mysql.sock

Usr/bin/mysql refers to the running path of mysql

Var/lib/mysql refers to the path where mysql database files are stored.

Usr/lib/mysql refers to the installation path of mysql

1. The daemon of mysql is mysqld.

If it is already installed:

[root@localhost ~] # service mysqld start

Start MySQL: [OK]

If it is not installed:

[root@localhost ~] # service mysqld start

Mysqld: unrecognized service

You can see if your service has been added to linux.

[root@localhost] # chkconfig-- list mysqld

Mysqld 0: off 1: close 2: close 3: close 4: close 5: enable 6: close

Without installation:

[root@localhost] # chkconfig-- list mysqld

Error reading information in mysqld service, there is no file or directory

Once the service is started, you can check to see if the server is running

[root@localhost ~] # ps-el | grep mysqld

4 S 0 1796 1 085 0-1513 wait? 00:00:00 mysqld_safe

4 S 27 1856 1796 0 78 0-34055 -? 00:00:00 mysqld

If you see it, it means that the server is installed.

Check whether apache is installed and its version under Linux

If it is installed through the rpm package, use the following command directly:

Rpm-Q httpd

You can also use the following two methods:

Httpd-v

Apachectl-v

Uninstall mysql method under Linux

a. Find the installed version of myslq:

# rpm-qa | grep mysql (pay attention to case and change MySQL if mysql fails)

Display:

[root@localhost ~] # rpm-qa | grep mysql

Mysql-5.0.77-4.el5_4.2

Mysql-server-5.0.77-4.el5_4.2

Php-mysql-5.2.13-1.el5.art

The installed mysql package name such as: mysql-5.0.77-4.el5_4.2 will be displayed on the screen

Uninstall the searched package name:

# rpm-e-nodeps mysql-5.0.77-4.el5_4.2 (nodeps means forced deletion)

Prompt

Error: package-nodeps is not installed

Error: package mysql-.0.77-4.e15_.2 is not installed

Linux View mysql installation path

First, view the file installation path

Since the software is installed in more than one place, check all the paths (addresses) of the file installation first.

Take mysql as an example. For example, mysql is installed, but you don't know where the files are installed or in which folders. You can check all the file paths with the following command

Enter: whereis mysql at the terminal

Enter, if mysql is installed, the address of the file installation will be displayed, such as my display (the installation address may be different)

[root@localhost ~] # whereis mysql

Mysql: / usr/bin/mysql / usr/lib/mysql / usr/share/mysql / usr/share/man/man1/mysql.1.gz

Second, query the path where the running file is located (folder address)

If you only need to query the address where the file is running, you can simply use the following command (or take mysql as an example):

Which mysql

Terminal display:

[root@localhost ~] # which mysql

/ usr/bin/mysql

At this point, the study on "how to view the installation path of MySQL under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report