简体   繁体   English

无法启动mysql(mariadb)

[英]fail to start mysql(mariadb)

i have been spending hours figuring out problems in connection mysql to use mariadb eventually. 我已经花了几个小时弄清楚连接mysql中的问题,最终还是要使用mariadb。 here's a situation. 这是一种情况。

situation: 情况:

1.i use macbook, and i am not that familiar with computer programming. 1.我使用的是Macbook,而我对计算机编程并不那么熟悉。 i tried to connect java eclipse and mariadb. 我试图连接java eclipse和mariadb。 so i looked it up online. 所以我在网上查了一下。 and at the same time, i opened up terminal and started my mysql using 同时,我打开终端并使用以下命令启动mysql

mysql.server start

and it worked. 而且有效。 and i was supposed to download mariaddb.2.2 jar something to connect it with eclipse, but i mistakenly downloaded "mariadb-10.2.12-osx10.13-x86_64.pkg" and installed it. 而且我应该下载mariaddb.2.2 jar使其与Eclipse连接,但是我错误地下载了“ mariadb-10.2.12-osx10.13-x86_64.pkg”并安装了它。 and i also typed 我也输入了

mysql.server stop

and all that kind of things. 以及所有类似的东西。 lots and lots of things so that i can`t even remember after i found out i downloaded the wrong things, i felt like this is way beyond my skills, so i jumped back to play with mariadb. 很多东西让我什至不记得我发现下载了错误的东西之后,我觉得这超出了我的能力,所以我跳回去玩mariadb。

i opened up terminal and typed 我打开终端并输入

mysql.server start

and termial keeps showing me this until now 直到现在,Terminal一直向我展示这个

.180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'.
180322 00:04:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
. ERROR! 

i still think that this tragedy started beacause i installed mariadb again... i literally tried everything and still couldn`t figure it out. 我仍然认为这场悲剧开始了,因为我再次安装了mariadb ...我确实尝试了一切,但仍然无法解决。 please help me!! 请帮我!!

From your initial post you can see that mariadb is logging the following file. 从最初的帖子中,您可以看到mariadb正在记录以下文件。

180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err' 180322 00:04:47 mysqld_safe登录到'/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'

Inside that file you found the following error. 在该文件中,您发现了以下错误。

2018-03-22 0:36:36 140736284734272 [ERROR] Can't start server: Bind on TCP/IP port. 2018-03-22 0:36:36 140736284734272 [错误]无法启动服务器:在TCP / IP端口上绑定。 Got error: 48: Address already in use 2018-03-22 0:36:36 140736284734272 [ERROR] Do you already have another mysqld server running on port: 3306 ? 得到错误:48:地址已在使用中2018-03-22 0:36:36 140736284734272 [错误]您是否已经在端口3306上运行了另一个mysqld服务器? 2018-03-22 0:36:36 140736284734272 [ERROR] Aborting 2018-03-22 0:36:36 140736284734272 [错误]中止

The key part of the error is Address already in use . 错误的关键部分是Address already in use Everything running on your computer that listens for connections (like a database or a web server) will listen on a specific port. 侦听连接的计算机上运行的所有内容(例如数据库或Web服务器)都将侦听特定端口。 MySQL (and therefore MariaDB) listens on port 3306 by default. 默认情况下,MySQL(因此,MariaDB)在端口3306进行侦听。 The important part is that you can't have multiple applications listening on the same port ! 重要的是您不能在同一端口上监听多个应用程序

So where do you go from here? 那你从这里去哪里呢? I suspect you still have MySQL running on your laptop, and once you stop it you will be able to start up a new instance. 我怀疑您的笔记本电脑上仍在运行MySQL,一旦停止,便可以启动新实例。

To check if MySQL is running you can use the following command: 要检查MySQL是否正在运行,可以使用以下命令:

ps -ef | grep mysql

If anything shows here then it is running, and you should stop the service. 如果此处显示任何内容,则表明它正在运行,您应该停止该服务。 How you do this will vary depending on how you installed it - try mysql.server stop first and run the above command again. 具体操作方式取决于安装方式-请先尝试mysql.server stop ,然后再次运行上述命令。 If it is still running and you can't figure it out then you can kill the service. 如果它仍在运行,而您无法解决,则可以kill该服务。 This is not recommended and cause MySQL data corruption - although if you have no data there then you should be OK. 不建议这样做,因为它会导致MySQL数据损坏-尽管如果那里没有数据,那应该可以。

Example output of ps -ef . ps -ef示例输出。 Yours should show MySQL near the end, and the second column shows the process ID which you can use to kill the process. 您应该在结尾处显示MySQL,第二列显示您可以用来杀死该进程的进程ID。

    PID
    \/
0  9504  9491   0  3:44pm ttys007    0:00.00 ps -ef`

So I would use: 所以我会用:

kill 9504

You should then be able to start the service again. 然后,您应该能够再次启动该服务。

mysql.server start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM