如何启动mysql2服务器?
我正在尝试在本地计算机上运行一些开源代码。它使用的是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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您安装了 gem,请在运行 $rails server 之前启动 mysql
If you have your gem installed, start mysql before you run
$ rails server
安装MySql数据库:
启动MySql服务器:
停止MySql服务器:
重新启动MySql服务器:
检查MySql服务器的状态:
To install MySql database:
To start MySql server:
To stop MySql server:
To restart MySql server:
To check the status of MySql server:
没有 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).如果您有 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.