how to start mysql2 server? - 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?

If you have your gem installed, start mysql before you run $ rails server
$ 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.

Related

Problems installing MySQL 5.7 properly on fresh CentOS 7 install

I admit that I am new to back-end work in general and I seem to be stuck (for several hours) following through with completing the setting up process for Magento 2.3
I was following https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html for my commands but to no success.
I managed to get the following installed:
Cent OS 7 (x86_64)
Apache 2.4.6
PHP 7.2.14 (all the extensions installed passed the Setup Wizard readiness check)
I used these commands to install MySQL 5.7 Community Release: (from the documentation)
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql mysql-server
yum -y install mysql-community-server
To check if my installation went well, when I run:
mysql --version
I received an error message saying:
-bash: /usr/bin/mysql: No such file or directory
I know that there is something I definitely am missing out completely. When I try to start the MySQL service using the command:
systemctl start mysqld
I get the resulting error message:
Failed to start mysqld.service: Unit not found.
Any suggestions will much be appreciated. Thank you in advance.
Maybe it installed it as mariadb?
systemctl start mariadb
After removing MySQL 5.7 community release from my Cent OS, I decided to install MariaDB.
Inside the directory /etc/yum.repos.d/ I've created a file called MariaDB.repo and added this into the file:
# MariaDB 10.3 CentOS repository list - created 2019-01-25 05:36 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
I then performed the command in my terminal window:
sudo yum install MariaDB-server MariaDB-client
Because of this, mysql --version and systemctl start mysql works like a charm. Thanks #greenberet123 and #danblack for the suggestion.

How to install 'systemctl' on Ubuntu (docker)?

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it.
Installation went fine (apt-get install -y mysql-server) and now is time to run a server:
systemctl status mysql
Failed to connect to bus: No such file or directory
How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?
Systemd is not installed on the ubuntu docker image. You can use the "service" command
service mysql start
service mysql status
You can also use the mysql docker image instead of installing mysql manually on ubuntu.
Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

What's the correct way of installing MySQL on CentOS 6.6 on Compute Engine by Google?

I've been trying to install MySQL on CentOS 6.6 but with no good results. I have just created a new VM with these steps:
1.- sudo yum -y install mysql-server mysql
2.- sudo mysql -u root
RESULT .- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
also doing a "sudo service mysql start"
RESULT mysql: unrecognized service
Thanks mates !
Try
sudo /etc/init.d/mysqld start
or
sudo service mysqld start

How to install MySQL in Fedora20?

How to install MySQL in Fedora20?
and how to open mysql prompt after installation using guest user.
How to install MySQL in Fedora20?
Fedora uses the MariaDB fork of MySQL. It's a drop in replacement for MySQL.
To install the server package, run the following as root:
# yum install mariadb-server
To start the server, run the following as root:
# systemctl start mysqld.service
To enable the server to start on boot, run the following as root:
# systemctl enable mysqld.service
and how to open mysql prompt after installation using guest user.
This response to the second part of your question, assumes that you have already installed the server package as above, and started it, and want to connect to that server:
First, install the client package. Run the following as root:
# yum install mariadb
Then run the client (prompt), by invoking the following:
$ mysql

MySQL server not running as service

I Have Installed mysql-server as root with command :
sudo apt-get install mysql-server
i have configured and changes too many things related to the mysql-server Now the problem is that Mysql is not working as service
as it is not in /etc/init.d
I want the mysql server to be started at boot time means to make it the service.
Now what i have to do please help.
I find chkconfig easy to use: sudo chkconfig --list|grep mysql but it might be an outdated mode of handling it. Most of my servers have long used it but I find my desktop Ubuntu didn't have it and complains if I use it.
If you don't have chkconfig, do sudo apt-get install chkconfig
To turn it on: chkconfig mysql on