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?
如果您已经安装了gem,请在运行$ rails server
之前启动mysql。
$ mysql.server start
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
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).
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.