Connection to database 'zabbix-server' failed - zabbix

OS: RHEL 8.5
mysql version : 8.0.26
Zabbix version : 5.0
Problem : Cannot connect to the database
Jan 27 14:00:23 zabbix zabbix_server[26357]: Got signal [signal:15(SIGTERM),sender_pid:26520,sender_uid:0,reason:0]. Exiting ...
Jan 27 14:00:23 zabbix zabbix_server[26377]: syncing history data in progress...
Jan 27 14:00:23 zabbix zabbix_server[26377]: syncing history data done
Jan 27 14:00:23 zabbix zabbix_server[26397]: [Z3005] query failed: [2006] MySQL server has gone away [select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,e.source,e.object,e.objectid,a.parameters,a.eventid,a.p_eventid from alerts a left join events e on a.eventid=e.eventid where alerttype=0 and a.status=3 order by a.alertid]
Jan 27 14:00:23 zabbix zabbix_server[26397]: [Z3001] connection to database 'zabbix-server' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jan 27 14:00:23 zabbix zabbix_server[26397]: database is down: reconnecting in 10 seconds
Jan 27 14:00:23 zabbix zabbix_server[26357]: [Z3001] connection to database 'zabbix-server' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jan 27 14:00:23 zabbix zabbix_server[26357]: Cannot connect to the database. Exiting...
Jan 27 14:00:30 zabbix systemd[1]: zabbix-server.service: Can't open PID file /run/zabbix/zabbix_server.pid (yet?) after start: No such file or directory
When i try to execute the command manually
mysql -u zabbix-server -p zabbix-server -S /var/lib/mysql/mysql.sock
It work without problem...
This is my /etc/my.cnf
##
# Ansible managed
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#bind-address=0.0.0.0
bind-address=localhost
max_allowed_packet=64M
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 2802M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
I tried every possible solution but nothing seems to work for me:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Related

Getting a socket error when trying to connect to MySQL

I updated my Linode server from Debian 8 to 11, and this has caused multiple issues. I'm aware this was a very silly thing to do, and I didn't even have any real backup strategy.
But anyway, I'm setting up a new Linode and trying to migrate everything over. I need to get a backup of my MySQL database, but when I try to access MySQL, I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
This command:
sudo find / -type s | grep mysql
returns nothing. So it looks like there is no socket file present. I have confirmed that MySQL is in fact running, by entering:
systemctl status mysql
The output is:
? mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; generated)
Active: active (exited) since Thu 2021-12-02 14:25:19 GMT; 18min ago
Docs: man:systemd-sysv-generator(8)
Process: 2643 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCC>
CPU: 2ms
Dec 02 14:25:19 odaiba systemd[1]: Starting LSB: Start and stop the mysql datab>
Dec 02 14:25:19 odaiba systemd[1]: Started LSB: Start and stop the mysql databa>
lines 1-9/9 (END)
I ran this command:
cat /etc/mysql/my.cnf
which returned the following output:
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-/
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
# Port or socket location where to connect
# port = 3306
socket = /run/mysqld/mysqld.sock
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
There is no /run/mysqld directory. I created it, and restarted MySQL, but this seemed to make no difference. I'm not sure how to set this my.cnf file to properly define or create the socket.
I'm also a little confused about all the references to MariaDB. Could that be something to do with the issue?
Any help at all is hugely appreciated!!

configure MySQL8.0 on centos7

First, when excuting an order
mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2), it would go wrong.
Second,when excuting an order
systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 三 2019-10-30 01:29:29 CST; 20min ago
Process: 30824 ExecStart=/usr/bin/mysqld --defaults-file=/etc/mysql/my.cnf --datadir=/var/lib/mysql/data --socket=/var/run/mysqld/mysqld.sock User=mysql (code=exited, status=203/EXEC)
Main PID: 30824 (code=exited, status=203/EXEC)
10月 30 01:29:29 VM_0_6_centos systemd[1]: Started MySQL Server.
10月 30 01:29:29 VM_0_6_centos systemd[1]: Starting MySQL Server...
10月 30 01:29:29 VM_0_6_centos systemd[1]: mysqld.service: main process exited, code=exited, status=203/EXEC
10月 30 01:29:29 VM_0_6_centos systemd[1]: Unit mysqld.service entered failed state.
10月 30 01:29:29 VM_0_6_centos systemd[1]: mysqld.service failed.
Third, default_file of mysql is my.cnf:
1 # For advice on how to change settings please see
2 # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
3
4 [mysqld]
5 #
6 # Remove leading # and set to the amount of RAM for the most important data
7 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
8 # innodb_buffer_pool_size = 128M
9 #
10 # Remove the leading "# " to disable binary logging
11 # Binary logging captures changes between backups and is enabled by
12 # default. It's default setting is log_bin=binlog
13 # disable_log_bin
14 #
15 # Remove leading # to set options mainly useful for reporting servers.
16 # The server defaults are faster for transactions and fast SELECTs.
17 # Adjust sizes as needed, experiment to find the optimal values.
18 # join_buffer_size = 128M
19 # sort_buffer_size = 2M
20 # read_rnd_buffer_size = 2M
21 #
22 # Remove leading # to revert to previous value for default_authentication_plugin,
23 # this will increase compatibility with older clients. For background, see:
24 # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentic ation_plugin
25 # default-authentication-plugin=mysql_native_password
26
27 datadir=/var/lib/mysql
28 socket=/var/lib/mysql/mysql.sock
29
30 log-error=/var/log/mysqld.log
31 pid-file=/var/run/mysqld/mysqld.pid
32
33 [mysql]
34
35 socket=/var/lib/mysql/mysql.sock
36 [client]
37 socket=/tmp/mysql.sock
Fourth,I can't find mysql.sock, mysql.server and mysql_safe in my machine.After install mysql-server, it still go wrong.
yum install mysql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package mysql-community-server-8.0.18-1.el7.x86_64 already installed and latest version
Nothing to do
[root#VM_0_6_centos /root]# find ./* -name mysql.server
What can I do?

ubuntu - mysql start and restart issue on ubuntu 16.04 server

i installed mysql 5.7 but then found out I need mysql 5.6 so i deleted all mysql related packages with
apt-get remove --purge mysql*
so it gotten removed. then i issued:
apt-get install mysql-server-5.6 mysql-client-5.6
so the mentioned packages gotten installed.
but its not starting using systemctl start mysql or service mysql start or even restart. the result is this:
service mysql restart
or
service mysql start
or
systemctl restart mysql
or
systemctl start mysql
returns:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
but
systemctl status mysql
returns
mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-04-10 13:24:00 EDT; 29s ago
Docs: man:systemd-sysv-generator(8)
Process: 15820 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Main PID: 1323 (code=exited, status=0/SUCCESS)
Apr 10 13:23:30 server mysqld[15926]: 2017-04-10 13:23:30 15925 [Note] InnoDB: Compressed tables use zlib 1.2.8
Apr 10 13:23:30 server mysqld[15926]: 2017-04-10 13:23:30 15925 [Note] InnoDB: Using Linux native AIO
Apr 10 13:23:30 server mysqld[15926]: 2017-04-10 13:23:30 15925 [Note] InnoDB: Using CPU crc32 instructions
Apr 10 13:23:30 server mysqld[15926]: 2017-04-10 13:23:30 15925 [Note] InnoDB: Initializing buffer pool, size = 128.0M
Apr 10 13:23:30 server mysqld[15926]: 2017-04-10 13:23:30 15925 [Note] InnoDB: Completed initialization of buffer pool
Apr 10 13:24:00 server mysql[15820]: ...fail!
Apr 10 13:24:00 server systemd[1]: mysql.service: Control process exited, code=exited status=1
Apr 10 13:24:00 server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Apr 10 13:24:00 server systemd[1]: mysql.service: Unit entered failed state.
Apr 10 13:24:00 server systemd[1]: mysql.service: Failed with result 'exit-code'.
what is Failed to start LSB: Start and stop the mysql database server daemon.
before installing 5.6 the 5.7 version was working fine but now its like this.
the /var/log/mysql/errors.log is empty and these are the /var/log/syslog last lines
Apr 10 13:23:30 server mysqld: 2017-04-10 13:23:30 15925 [Note] InnoDB: Completed initialization of buffer pool
Apr 10 13:23:30 server mysqld_safe: mysqld from pid file /var/lib/mysql/server.pid ended
Apr 10 13:24:00 server /etc/init.d/mysql[16277]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Apr 10 13:24:00 server /etc/init.d/mysql[16277]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Apr 10 13:24:00 server /etc/init.d/mysql[16277]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Apr 10 13:24:00 server /etc/init.d/mysql[16277]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Apr 10 13:24:00 server /etc/init.d/mysql[16277]:
Apr 10 13:24:00 server mysql[15820]: ...fail!
Apr 10 13:24:00 server systemd[1]: mysql.service: Control process exited, code=exited status=1
Apr 10 13:24:00 server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Apr 10 13:24:00 server systemd[1]: mysql.service: Unit entered failed state.
Apr 10 13:24:00 server systemd[1]: mysql.service: Failed with result 'exit-code'.
output of mysqld_safe
170410 13:33:28 mysqld_safe Logging to syslog.
170410 13:33:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170410 13:33:28 mysqld_safe mysqld from pid file /var/lib/mysql/server.pid ended
and this is my /etc/mysql/my.cnf and there is no /etc/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
!includedir /etc/mysql/conf.d/
This problem arrives when your /etc/mysql/mysql.conf.d/mysqld.cnf file is wrongly set. If you recently made changes to this file please revert to the previous one or copy the default one here
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log = 1
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
#expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
Stop mysql service:
sudo service mysql stop
Remove mysql:
sudo apt-get remove mysql
sudo apt-get purge mysql
Then issue a whereis mysql command in terminal and remove all of the locations that command lists using rm -rf command. For example rm -rf /etc/mysql .
Then reinstall the version of mysql you desire. All should work as expected.
Just check if you db has been given the rights to write the logs give it the logs writing rights and this will get resolved .
1)First remove already installed mysql-server using--
sudo apt-get remove --purge mysql-server mysql-client mysql-common
2)Then clean all files
sudo apt-get autoremove
3)Then install mysql-server --
sudo apt-get remove -f mysql-server
4)Start mysql server--
sudo systemctl start mysql
5)Check status of mysql-server--
systemctl status mysql

MariaDB is not checking password on Ubuntu 15.04

I installed Ubuntu Server 15.04 and MariaDB 10.0.17 on my server.
When install MariaDB, I can't see password setting page, and install is complete.
So I try to change my root password using SET PASSWORD and UPDATE table.
But, not happened.
I can access MySQL using any password and no password.
Like this:
root#kuroneko-Server:~# mysql -uroot -p
Enter password: [Type 'itsnotpassword']
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 10.0.17-MariaDB-0ubuntu1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
I already tring flush privileges; and service mysql restart.
Reinstall ubuntu, reinstall mariadb... etc.
service mysql status:
root#kuroneko-Server:~# service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: active (running) since 금 2015-05-22 11:17:41 EDT; 34min ago
Docs: man:systemd-sysv-generator(8)
Process: 8127 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 8158 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.service
├─8183 /bin/bash /usr/bin/mysqld_safe
├─8184 logger -p daemon.err -t /etc/init.d/mysql -i
└─8338 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
5월 22 11:17:40 kuroneko-Server systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
5월 22 11:17:40 kuroneko-Server mysql[8158]: * Starting MariaDB database server mysqld
5월 22 11:17:41 kuroneko-Server mysql[8158]: ...done.
5월 22 11:17:41 kuroneko-Server systemd[1]: Started LSB: Start and stop the mysql database server daemon.
MariaDB setting.
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server = utf8
collation-server = utf8_general_ci
character_set_server = utf8
collation_server = utf8_general_ci
#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add = auth_socket.so
Does anyone know about this?
I can't find any information about this problem.
See: http://ubuntuforums.org/showthread.php?t=2275033
And execute the below sql:
USE mysql;
UPDATE user
SET password=PASSWORD('NEW_PASSWORD'),
plugin=''
WHERE user='root';
FLUSH PRIVILEGES;
PS: Because of safe consideration, the plugin field on root users was set, in order to prevent non-root user login. So cancelling that plugin will work.
The answer is right there in your config file
#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add = auth_socket.so
The auth_socket.so allows when you are the root, to login without password prompt. So you can ideally login with just typing "mysql"
MariaDB 10.0.17 cannot access root with non-root user.
(Includ web access)
And anyone can access MariaDB root with ubuntu root user.
(Not Certification)
So make new root2 user to managed mysql on web.
Unix socket authentication plugin is built-in since 10.0.22-6
Needed so the root database user can authenticate without a password but only when running as the unix root user.
Also available for other users if required.
See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

Missing mysql.sock file. phpMyAdmin - Fedora 17

I run Fedora 17 with "Webadmin". So I tried to use webadmin option to update upload maximum size to my MySQL database. Now, I not able to restart mysqld. I have no GUI, so when run systemctl status mysqld.service I gives me this message:
[root#localhost ~]# systemctl status mysqld.service
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: failed (Result: exit-code) since Mon, 30 Jul 2012 15:08:26 -0400; 6min ago
Process: 3560 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 3559 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 3542 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/mysqld.service
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
or when I try to access my phpmyadmin screen i see this message:
phpMyAdmin - Error
#2002 - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The server is not responding (or the local server's socket is not correctly configured).
When I run in terminal locate mysql.sock it shows the correct path /var/lib/mysql/mysql.sock.
But when I run this command ls /var/lib/mysql, I not able to locate this file.
Please help.
After punching my monitor and kicking my server I was able to find a fix. Not sure how safe or good at is, but it works to me.
In terminal open up your my.cnf file # nano /etc/my.cnf
Delete or just comment all existing settings with '#', then just paste this code that I found on http://blog.mclaughlinsoftware.com/2011/12/07/fixing-my-cnf-on-fedora/
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# Default directory.
datadir=/var/lib/mysql
# The TCP/IP Port the MySQL Server listens on.
port=3306
# The Linux Socket the MySQL Server uses when not using a listener.
# socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# The default storage engine that will be used when creating new tables.
default-storage-engine=INNODB
# Set the SQL mode to strict.
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# Set the maximum number of connections.
max_connections=100
# Set the number of open tables for all threads.
table_cache=256
# Set the maximum size for internal (in-memory) temporary tables.
tmp_table_size=26M
# Set how many threads should be kept in a cache for reuse.
thread_cache_size=8
# MyISAM configuration.
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=52M
key_buffer_size=36M
read_rnd_buffer_size=256K
sort_buffer_size=256K
# InnoDB configuration.
innodb_data_home_dir=/var/lib/mysql
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=25M
innodb_log_file_size=5M
innodb_thread_concurrency=8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Open for any comments or suggestions.
Thank you.