如何检查mysql是否安装在ubuntu上?

时间:2022-06-27 07:13:05

I need to check if mysql is installed on a ubuntu server. Is there a way to determine if mySql has been installed ? Thanks.

我需要检查mysql是否安装在ubuntu服务器上。有没有办法确定mySql是否已经安装?谢谢。

7 个解决方案

#1


56  

dpkg --get-selections | grep mysql if it's listed as installed, you got it. Else you need to get it.

dpkg——get- choose | grep mysql如果它被列出为已安装,您就会得到它。否则你需要得到它。

#2


14  

Multiple ways of searching for the program.

搜索程序的多种方式。

Type mysql in your terminal, see the result.

在终端中输入mysql,查看结果。

Search the /usr/bin, /bin directories for the binary.

在/usr/bin、/bin目录中搜索二进制文件。

Type apt-cache show mysql to see if it is installed

键入apt-cache,显示mysql是否已安装

locate mysql

定位mysql

#3


11  

"mysql" may be found even if mysql and mariadb is uninstalled, but not "mysqld".

即使不安装mysql和mariadb,也可以找到“mysql”,但不能找到“mysqld”。

Faster than rpm -qa | grep mysqld is:

快于rpm -qa | grep sqmyld为:

which mysqld

#4


2  

In an RPM-based Linux, you can check presence of MySQL like this:

在基于rpm的Linux中,您可以像这样检查MySQL的存在:

rpm -qa | grep mysql

rpm -qa | grep mysql

For debian or other dpkg-based systems, check like this: *

对于debian或其他基于dpkgs的系统,请检查如下:*。

dpkg -l mysql-server libmysqlclientdev*

*

*

#5


2  

With this command:

使用这个命令:

 dpkg -s mysql-server | grep Status

#6


1  

# mysqladmin -u root -p status

Output:

输出:

Enter password:
Uptime: 4  Threads: 1  Questions: 62  Slow queries: 0  Opens: 51  Flush tables: 1  Open tables: 45  Queries per second avg: 15.500

It means MySQL serer is running

这意味着MySQL serer正在运行

If server is not running then it will dump error as follows

如果服务器没有运行,那么它将转储错误如下

# mysqladmin -u root -p status

Output :

输出:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

So Under Debian Linux you can type following command

所以在Debian Linux下,你可以输入以下命令

# /etc/init.d/mysql status

#7


1  

Try executing 'mysql' or 'mysql -- version' without quotes on terminal. it will prompt version otherwise Command Not Found

尝试在终端上执行“mysql”或“mysql - version”而不带引号。它将提示版本,否则未找到命令

#1


56  

dpkg --get-selections | grep mysql if it's listed as installed, you got it. Else you need to get it.

dpkg——get- choose | grep mysql如果它被列出为已安装,您就会得到它。否则你需要得到它。

#2


14  

Multiple ways of searching for the program.

搜索程序的多种方式。

Type mysql in your terminal, see the result.

在终端中输入mysql,查看结果。

Search the /usr/bin, /bin directories for the binary.

在/usr/bin、/bin目录中搜索二进制文件。

Type apt-cache show mysql to see if it is installed

键入apt-cache,显示mysql是否已安装

locate mysql

定位mysql

#3


11  

"mysql" may be found even if mysql and mariadb is uninstalled, but not "mysqld".

即使不安装mysql和mariadb,也可以找到“mysql”,但不能找到“mysqld”。

Faster than rpm -qa | grep mysqld is:

快于rpm -qa | grep sqmyld为:

which mysqld

#4


2  

In an RPM-based Linux, you can check presence of MySQL like this:

在基于rpm的Linux中,您可以像这样检查MySQL的存在:

rpm -qa | grep mysql

rpm -qa | grep mysql

For debian or other dpkg-based systems, check like this: *

对于debian或其他基于dpkgs的系统,请检查如下:*。

dpkg -l mysql-server libmysqlclientdev*

*

*

#5


2  

With this command:

使用这个命令:

 dpkg -s mysql-server | grep Status

#6


1  

# mysqladmin -u root -p status

Output:

输出:

Enter password:
Uptime: 4  Threads: 1  Questions: 62  Slow queries: 0  Opens: 51  Flush tables: 1  Open tables: 45  Queries per second avg: 15.500

It means MySQL serer is running

这意味着MySQL serer正在运行

If server is not running then it will dump error as follows

如果服务器没有运行,那么它将转储错误如下

# mysqladmin -u root -p status

Output :

输出:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

So Under Debian Linux you can type following command

所以在Debian Linux下,你可以输入以下命令

# /etc/init.d/mysql status

#7


1  

Try executing 'mysql' or 'mysql -- version' without quotes on terminal. it will prompt version otherwise Command Not Found

尝试在终端上执行“mysql”或“mysql - version”而不带引号。它将提示版本,否则未找到命令