mysqld: unrecognized service - mysql

I'm trying to install a MySql Server on Red Hat Linux.
I've downloaded the tar file and unarchived it.
Then, I ran:
rpm -qpl mysql-community-server-5.7.17-1.e16.x86_64.rpm
Then I tried running
service mysqld start
But I'm getting mysqld: unrecognized service
I also tried using the full path to the mysqld: service /usr/sbin/mysqld/ start but that shows the same issue.
Any idea what is wrong?

on my Ubuntu platform, I encountered the same problem showing "mysqld: unrecognized service".
to solve this error, the commend should be:
sudo service mysql start

Related

Can't connect to MySQL server on '127.0.0.1' (61) on Mac

Having some trouble creating a mysql connection. The mysql instance is running in system preferences and I have made sure the mysql config file is in the right location(Test settings passed). When I go into Test DB connections I get red cross on all three sections.(open database connections, get server version, get server OS). Running mac 10.10.2. Set connection name as home hostname as 127.0.0.1, port as 3306, username as root, password as my computers root password and default schema as home as well. Any ideas?
Delete pid files using this command:
$ cd /usr/local/var/mysql
$ sudo rm -rf [networkname*].err
$ sudo rm -rf [networkname*].pid
Now restart server use brew sevices
$ brew services restart mysql
∗your network name like "Tanbirs-Mac-mini.local"
(use echo $HOST)
You can see this type of error , try this:
run this command on your iTerm or Terminal:
sudo mysql.server start
If you see some errors like this:
my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Starting MySQL
.my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
ERROR! The server quit without updating PID file (/usr/local/var/mysql/MacBook-Pro.local.pid).
Just make the dir:
mkdir /usr/local/etc/my.cnf.d
and then run it again:
sudo mysql.server start
Works for me.
I just had this and the only solution that worked for me was to remove the ib_logfile* files from /usr/local/var/mysql, similar to Engr.Tanbir Hasan's answer:
cd /usr/local/var/mysql
rm ib_logfile*
Then restart with (I'm using MariaDB, but same applies to MySQL):
brew services restart mariadb
# or
brew services restart mysql
I found the solution here.
Today i have come with this issue, i solved it using the following steps:
First, check whether listening to the port 3306:
netstat -tulpen
if it prints the following log, it would be right:
...
tcp6 0 0 :::3306 :::* LISTEN 27 46396 22054/mysqld
...
otherwise, edit the file my.cnf and add the code to it:
bind-address = 0.0.0.0
it means that it listens to all ports.
Secondly, in the CentOS 7 add the Mysql service to firewall:
sudo firewall-cmd --zone=public --permanent --add-service=mysql
it returns Success, and then going on executing the command:
sudo systemctl restart firewalld
Now, it's OK!!!
brew install mysql worked for me
Then brew services start mysql
I had the same issue and I updated following settings on MAMP/MySQL - Allow Network Access to MySQL to "Only From this Mac" and it fixed the issue for me. I have attached a screenshot here. Also port should be updated to 8889 instead of 3306.
I had same problem, but it worked for me.
check if you have mysql installed
If you don't have mysql installed, download from this link: https://dev.mysql.com/downloads/mysql/
follow this instructions to install
https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html
You can test the connection without any problem.
(Sorry for my english, I agree fix me please)
I Hope I've helped.
Greetings.
The database I use is dependent on DBngin running so this was the error I had.
Close your database management tool and then open the DBngin app and start mysql services. Then when you connect it'll have the database appear to allow you to connect

MySQL on ubuntu 12.04 won't run after MySQL Workbench installed

Recently I installed MySQL Workbench 6.2 and used it to create ER diagrams of the MySQL 5.5.41 databases I'm working with on Ubuntu 12.04. Everything worked fine until I restarted Ubuntu and suddenly mysql was no longer running. Running mysqld from the command line results in this:
150216 12:50:37 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
150216 12:50:37 [ERROR] Aborting
150216 12:50:37 [Note]
The file /usr/share/mysql/english/errmsg.sys exists, owned by root, with permissions 644. The directory /var/lib/mysql exists, owned by mysql, with permissions 700.
I'm guessing that the installation of Workbench changed something (maybe config files) so that mysql is no longer working, but after a fair amount of Internet research, I have not discovered how to solve this problem. Any help will be greatly appreciated.
Seems like file permission problem. Try running mysqld again using sudo
If this doesn't help, maybe you shouldn't be starting it directly via mysqld. Check if the installer package added a service
sudo service --status-all | grep mysql
And if one exist, use it to start mysql, typically:
sudo service mysqld start
Also don't forget to check if mysqld is already running. If so you can't start duplicate process. I know this sound silly but has happened to me before
ps -ef | grep mysqld

Infobright installation is unable to use mysql user

When trying to install Infobright, no matter what I try, it says it can't use the mysql-user.
If I try it with the dpkg -i infobright-4.0.7-0-i686-ice.deb, the log contains the following problems:
11:48:16 Installing infobright 4.0.7-0 (i686)
11:48:16 The installer will generate /tmp/ib4.0.7-0-install.log install trace log.
11:48:16 [step: pre (4.0.7-0, 1=upgrade)]
11:48:16 build type: static
11:48:19 [step: postun (4.0.7-0), 1=upgrade]
11:48:19 [step: post (4.0.7-0), 1=configure]
11:48:19 Install with RPM_INSTALL_PREFIX=/usr/local, current prefix=/usr/local/infobright, prefix_actual=/usr/local/infobright-4.0.7-i686
11:48:19 upgrade=
11:48:19 Config file /etc/my-ib.cnf created
11:48:19 sed -e 's+#BH_PORT#+5029+' -e 's+#BH_BASEDIR#+/usr/local/infobright-4.0.7-i686+' -e 's+#BH_SOCK#+/tmp/mysql-ib.sock+' -e 's+#BH_DATADIR#+/usr/local/infobright-4.0.7-i686/data+' < /usr/local/infobright-4.0.7-i686/support-files/my-ib-master.cnf.in > /etc/my-ib-master.cnf
11:48:19 sed -e 's+#BH_PORT#+5029+' -e 's+#BH_BASEDIR#+/usr/local/infobright-4.0.7-i686+' -e 's+#BH_SOCK#+/tmp/mysql-ib.sock+' -e 's+#BH_DATADIR#+/usr/local/infobright-4.0.7-i686/data+' < /usr/local/infobright-4.0.7-i686/support-files/my-ib-slave.cnf.in > /etc/my-ib-slave.cnf
11:48:19 Creating/Updating datadir and cachedir
11:48:19 Creating user mysql and group mysql
groupadd: Gruppe »mysql« existiert bereits.
useradd: Benutzer »mysql« existiert bereits
usermod: Keine Änderungen
11:48:19 Installing default databases
140902 11:48:19 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
140902 11:48:19 [ERROR] Aborting
140902 11:48:19 [Note] /usr/local/infobright-4.0.7-i686/bin/mysqld: Shutdown complete
11:48:19 =============ERROR=======================
11:48:19 Failed on infobright initialization. You can investigate /tmp/ib4.0.7-0-install.log and log files from /usr/local/infobright-4.0.7-i686/data.
11:48:19 At this stage the current installation may be broken. You need to uninstall it and
11:48:19 fix the cause before retrying the installation.
11:48:19 Possible reasons for the failure are: LDAP service is running or
11:48:19 system has unsupported glibc but nscd service is not running.
11:48:19 Possible work arounds are: If LDAP is running, you may stop LDAP service prior to the installation.
11:48:19 If you have unsupported glibc, you need to start nscd service prior to the installation.
11:48:19 =========================================
Unforunately, something similiar happens when I try to install it from the tarball - everytime, the error 140902 11:48:19 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists! appears and the installation can't be finished.
In Infobright startup error: Fatal error:, someone seems to have a similiar error but does not realy pose the question. Does anyone know, how to solve this problem?
Another, unrelated error seems to be http://blog.oneiroi.co.uk/linux/mysql/cant-change-to-run-as-user-mysql-please-check-that-the-user-exists/: Here, someone says I need to add the mysql-user. But I checked it, and the user exists an I am able to do something as this user. So unfortunately, I can't see any way to solve this problem.
You may use CentOS 6.2 or higher, which has a higher glibc version(2.12).
Compiling from source seems to be the only option. Tried that and got it working. We need to set
export LD_LIBRARY_PATH=/usr/local/boost_1_42_0/lib
before running the command
bin/mysql_install_db --defaults-file=/etc/my-ib.cnf --user=mysql
ICE Server is now up and running, and am able to login to the client as well. Only the /etc/init.d/mysqd-ib file is missing. Its very convenient to start and stop the server that way. Believe copying the file from another default installation should fix that. Will try that. Any suggestions in the meantime are welcome

ERROR! MySQL manager or server PID file could not be found! QNAP

I am having an issue where MySQL isn't starting on my QNAP NAS.
I found this first by not being able to log in through phpMyAdmin - was getting error:
#2002 Cannot log in to the MySQL server
I then went to attempt to start mysql, as I guess this is a common issue with this, but it just gave a generic error.
I went through troubleshooting the mysql.sock file and everything, changing its permissions, but nothing is working.
I have rebooted my NAS many times.
I eventually tried to restart mysql. In doing so I get:
ERROR! MySQL manager or server PID file could not be found!
I can't find anything specific to the QNAP or any general type troubleshooting for this. Everything I find seems to be OSX related.
After a lot of searching, I was able to fix the "PID file cannot be found" issue on my machine. I'm on OS X 10.9.3 and installed mysql via Homebrew.
First, I found my PID file here:
/usr/local/var/mysql/{username}.pid
Next, I located my my.cnf file here:
/usr/local/Cellar/mysql/5.6.19/my.cnf
Finally, I added this line to the bottom of my.cnf:
pid-file = /usr/local/var/mysql/{username}.pid
Hopefully this works for someone else, and saves you a headache! Don't forget to replace {username} with your machine's name (jeffs-air-2 in my case).
I tried everything above, but saw no results until I got a hint from here: https://superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have-it-restart-on-its-own
I eventually went over to the activity monitor in my Mac, force Quit the PID, and ran the command:
sudo /usr/local/mysql/support-files/mysql.server restart
The magic was done!!!
If you have installed MySQL using brew the best way to go would be with homebrew
brew services restart mysql
after you run that command, all the problems that the update generated will be resolved
I ended up figuring this out on my own.
In searching for my logs I went into
cd /usr/local/mysql/var
In there I found the file named [MyNAS].pid (replace [MyNAS] with the name of your NAS.
I then ran the following to remove the file
rm -rf /usr/local/mysql/var/[MyNAS].pid
I then restarted mysql
[/usr/local/mysql/var] # /etc/init.d/mysqld.sh restart
/mnt/ext/opt/mysql
/mnt/ext/opt/mysql
Try to shutting down MySQL
ERROR! MySQL manager or server PID file could not be found!
/mnt/ext/opt/mysql
Starting MySQL. SUCCESS!
I tested everything and it all works like a charm again!
Run the below commands and it will work.
Go to terminal and type
sudo chown -RL root:mysql /usr/local/mysql
sudo chown -RL mysql:mysql /usr/local/mysql/data
sudo /usr/local/mysql/support-files/mysql.server start
Just run mysqld (don't run as root) from your terminal. Your mysql server will restart and reset everything like shown in the picture below:
And use a command like so:
mysql -u root -h 127.0.0.1
ERROR! MySQL server PID file could not be found!
This might be due to issues with disk space, disk inode usage or innodb corruption which may lead to the error.
The issue was with the pid file and the solution was:
SSH login to server as a root
Create directory /var/run/mysql
mkdir /var/run/mysql
3) Create a file with name as mysqld.pid
touch mysqld.pid
Change its ownership and group to mysql:mysql
chown mysql:mysql mysqld.pid
Restart MySQL service
Done!
I had the same issue. It turns out I added incorrect variables to the my.cnf file. Once I removed them and restarted mysql started with no issue.
Check if your server is full first, thats a common reason (can't create the PID file because you have no space). Run this to check your disk usage..
df -h
If you get something like this, you are full..
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 40G 6.3M 100% /
In that case, you need to start looking for what to delete to make room, or add an additional drive to your server.
Nothing of this worked for me. I tried everything and nothing worked.
I just did :
brew unlink mysql && brew install mariadb
My concern was if I would lost all the data, but luckily everything was there.
Hope it works for somebody else
Note: If you just want to stop MySQL server, this might be helpful.
In my case, it kept on restarting as soon as I killed the process using PID. Also brew stop command didn't work as I installed without using homebrew. Then I went to mac system preferences and we have MySQL installed there. Just open it and stop the MySQL server and you're done. Here in the screenshot, you can find MySQL in bottom of system preferences.
I know this is an older post, but I ran into the ERROR! MySQL server PID file could not be found! when trying to start MySQL after making an update to my.cnf file. I did the following to resolve the issue:
Deleted my experimental update to my.cnf
Deleted the .net.pid and .net.err files.
delete /usr/local/var/mysql/**<YourUserName>**-MBP.airstreamcomm.net.*
Ensured all MySQL processes are stopped.
ps -ax | grep mysql
kill **<process id>**
Started MySQL server as normal.
mysql.server start
First find PID of mysql service
ps aux | grep mysql
Then, you have to kill process
sudo kill <pid>
After you again start mysql service
mysql.server start
After doing setup of PHPMyAdmin, I was also facing the same problem,
Then I just stopped the MYSQL server by going into System settings, and then started again, and it worked.
root#host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/host.pxx.com.pid).
root#host [~]# vim /etc/my.cnf
Add Line in my.cnf its working know
innodb_file_per_table=1
innodb_force_recovery = 1
Result
root#host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL……….. [ OK ]
root#host [~]# service mysql restart
Shutting down MySQL…. [ OK ]
Starting MySQL. [ OK ]
Source
I have the same problem. I found the file {username}.local.err instead of {username}.local.pid inside /usr/local/mysql, then i changed the name *.err to *.pid and it works fine.
Starting MySQL.
SUCCESS!
My OS El Capitan 10.11.5
If you're using MySQL Workbench, the mysql.server stop/restart/start will not work.
You will need to login into the workbench and then click "shutdown server". See image attached.
I was able to solve this on OS X by shutting down the existing mysql.server that was running:
mysql.server stop
The starting:
mysql.server start
From there I could run mysql.server restart without throwing the ERROR.

fresh installed mysql and mysql-server but failed to start server

I am new to Linux and tried to install mysql in my local box
I googled a lot and follow the instruction but none of them works
some people recommand this" but it did not work for me and system give me warning about this is not a official version.
Basically what I did was:
yum install mysql mysql-version
succeed without error, version is 5.5.28
systemctl start mysqld.service
here it threw out error:
Job failed. See system logs and 'systemctl status' for details.
I am using Fedora 16 (3.1.0-7.fc16.i686)
Thank you in advance
Could you try running
yum groupinstall "MySQL Database"
then run
service mysqld start
and see the outcome. Assuming you are running as root or with root permissions.
Got the EXACT same problem. It seems there is an issue regarding the permissions of the /var/lib/mysql directory.
This nailed it for me:
chown -R mysql.mysql /var/lib/mysql
Source: http://www.vivaolinux.com.br/dica/Como-solucionar-ERROR-2002-Cant-connect-to-local-MySQL-server