如何启动mysql2服务器?

发布于 2024-12-18 15:28:25 字数 413 浏览 6 评论 0原文

我正在尝试在本地计算机上运行一些开源代码。它使用的是mysql2,我之前没有使用过这个数据库。我遇到了一些错误,可以通过运行来修复:

sudo apt-get install libmysql-ruby libmysqlclient-dev

我启动了 Rails 服务器,但是当我转到 http://localhost:3000 时/,我收到以下错误:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

我需要启动 MySQL 服务器吗?我该怎么做呢?

I am trying to get some open source code running on my local machine. It uses mysql2, and I have not used this database before. I had some errors I was able to fix by running:

sudo apt-get install libmysql-ruby libmysqlclient-dev

I start up the rails server but when I go to http://localhost:3000/, I get the following error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Do I need to start the MySQL server? How would I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

内心荒芜 2024-12-25 15:28:25

如果您安装了 gem,请在运行 $rails server 之前启动 mysql

$ mysql.server start

If you have your gem installed, start mysql before you run $ rails server

$ mysql.server start
心病无药医 2024-12-25 15:28:25

安装MySql数据库:

sudo apt-get install mysql-server

启动MySql服务器:

/etc/init.d/mysql start

停止MySql服务器:

/etc/init.d/mysql stop

重新启动MySql服务器:

/etc/init.d/mysql restart

检查MySql服务器的状态:

/etc/init.d/mysql status

To install MySql database:

sudo apt-get install mysql-server

To start MySql server:

/etc/init.d/mysql start

To stop MySql server:

/etc/init.d/mysql stop

To restart MySql server:

/etc/init.d/mysql restart

To check the status of MySql server:

/etc/init.d/mysql status
一身骄傲 2024-12-25 15:28:25

没有 mysql2 服务器。 mysql2 是 MySQL 客户端 gem(Ruby 库)的名称。您所需要的只是安装并启动 MySQL 服务器。

看来你的服务器是 Debian 或 Ubuntu。执行 apt-get install mysql-server 来安装 MySQL。您的 MySQL 服务器将自动启动(在 Ubuntu 上通过 Upstart 或在 Debian 上通过 sysinit)。

There is no mysql2 server. mysql2 is the name of a MySQL client gem (Ruby library). All you need is to install and start MySQL server.

It seems your server is Debian or Ubuntu. Execute apt-get install mysql-server to install MySQL. Your MySQL server will automatically start (by Upstart on Ubuntu or sysinit on Debian).

对风讲故事 2024-12-25 15:28:25

如果您有 lamp 服务器,只需在终端 /opt/lampp/lampp start 上键入命令。

请让我知道它是否适合您,或者我会做其他事情。

Just type command on terminal

/opt/lampp/lampp start if you have lamp server.Please let me know is it working for you,either I'll do other thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文