not able to set bind-address=[ip of my server] in mysql - mysql

I want to create a master-slave replication on ubuntu servers.
both(master and slave) on different servers.
i made my.cnf(without coments) file on master as:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
bind-address=my_server_ip
server-id=1
log_bin=/var/log/mysql/mysql-bin.log
binlog_do_db=indicators
then i restart using sudo service mysql restart and get the following error:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details
but when i set bind-address=127.0.0.1 it works fine.
below is the reference is used which says bind-address should be the address of master server
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
but it contadicts with below link which says(under comments section) bind-address is the ip of slave
https://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html
systemctl status mysql.service as in above error code
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:
enabled)
Active: activating (start-post) (Result: exit-code) since Sat 2017-11-04
07:12:12 UTC; 11s ago
Process: 25213 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 25205 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
(code=exited, status=0/SUCCESS)
Main PID: 25213 (code=exited, status=1/FAILURE); : 25214 (mysql-
systemd-s)
Tasks: 2
Memory: 400.0K
CPU: 250ms
CGroup: /system.slice/mysql.service
└─control
├─25214 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─25267 sleep 1
Nov 04 07:12:12 fundexpert-test-r systemd[1]: mysql.service: Service hold-
off time over, scheduling restart.
Nov 04 07:12:12 fundexpert-test-r systemd[1]: Stopped MySQL Community
Server.
Nov 04 07:12:12 fundexpert-test-r systemd[1]: Starting MySQL Community
Server...
Nov 04 07:12:14 fundexpert-test-r systemd[1]: mysql.service: Main process
exited, code=exited, status=1/FAILURE
journalctl -xe says:
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 04 07:12:42 fundexpert-test-r systemd[1]: mysql.service: Unit entered
failed state.
Nov 04 07:12:42 fundexpert-test-r systemd[1]: mysql.service: Failed with
result 'exit-code'.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: mysql.service: Service hold-
off time over, scheduling restart.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: Stopped MySQL Community
Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: Starting MySQL Community
Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd

below is the reference is used which says bind-address should be the address of master server
No it doesn't. It says 'replace the standard IP address with the IP address of server'. The word 'master' does not appear.
but it contadicts with below link which says(under comments section) bind-address is the ip of slave
No it doesn't. It says 'you will have to make sure that the slave's address or hostname is matched by the bind-address setting'.
You cannot bind to a non-local IP address.

Related

MySql 5.7 Server Can't Be Terminated

I installed MySql 5.7 for work, now I got an active MySql server running on standart port 3306, that I can't terminate.
I tried service mysql stop and service mysqld stop. No active processes as well.
This is the output of service mysql status :
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-11-16 10:09:46 CET; 9min ago
Process: 65951 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 65990 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Nov 16 10:09:44 user systemd[1]: Starting MySQL Community Server...
Nov 16 10:09:44 user mysqld[65990]: Initialization of mysqld failed: 0
Nov 16 10:09:44 user systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Nov 16 10:09:46 user systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 16 10:09:46 user systemd[1]: Stopped MySQL Community Server.
localhost:3006 Response :
Response
Output of journalctl -xe :
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 13189 and the job result is failed.
Nov 16 10:36:40 user systemd[1]: mysql.service: Scheduled restart job, restart counter is at 37.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 16 10:36:40 user systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 13262 and the job result is done.
Nov 16 10:36:40 user systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.
--
-- The job identifier is 13262.
Nov 16 10:36:40 user audit[71661]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld>
Nov 16 10:36:40 user kernel: audit: type=1400 audit(1668591400.604:1307): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=>
Nov 16 10:36:40 user mysqld[71662]: Initialization of mysqld failed: 0
Nov 16 10:36:40 user systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.

MySQL socket disappeared

I was running a Python script that lasted a few hours and executed insert statements. All locally on Debian. When I came back later to check on the script's status, I was no longer able to log into MySQL.
I had had a command line session going, and this was the message:
A similar message appears when I try to log in or run diagnostic functions like mysqldump. It appears that the socket just got up and walked away. The script and database had been running swimmingly several times before this. The only thing that changed was that I tweaked the script to do a heavier load (processing CSV files), so all can figure is that I ran out of memory and something crashed while I was away.
Trying to restart:
root#debian:/home/user# /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
root#debian:/home/user# /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
failed!
systemctl status mysql.service:
root#debian:/home/user# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled)
Active: activating (start-post) (Result: exit-code) since Fri 2019-02-15 19:26:44 JST; 12s ago
Process: 3324 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
Process: 3317 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 3324 (code=exited, status=2); : 3326 (mysql-systemd-s)
CGroup: /system.slice/mysql.service
└─control
├─3326 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─3373 sleep 1
Feb 15 19:26:44 debian systemd[1]: mysql.service holdoff time over, scheduling restart.
Feb 15 19:26:44 debian systemd[1]: Stopping MySQL Community Server...
Feb 15 19:26:44 debian systemd[1]: Starting MySQL Community Server...
Feb 15 19:26:46 debian systemd[1]: mysql.service: main process exited, code=exited, status=2/INVALIDARGUMENT
journalctl -xn:
Feb 15 19:26:44 debian systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Feb 15 19:26:44 debian systemd[1]: Unit mysql.service entered failed state.
Feb 15 19:26:44 debian systemd[1]: mysql.service holdoff time over, scheduling restart.
Feb 15 19:26:44 debian systemd[1]: Stopping MySQL Community Server...
-- Subject: Unit mysql.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun shutting down.
Feb 15 19:26:44 debian systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Feb 15 19:26:46 debian systemd[1]: mysql.service: main process exited, code=exited, status=2/INVALIDARGUMENT

MySQL server is not starting

When I do:
mysql -u root -p and type my password this is what I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
So I type this:
systemctl restart mysql
and I got following error:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
So I did journalctl -xe and got this output:
дек 14 22:57:29 kazak systemd[1]: mysql.service: Failed with result 'exit-code'.
дек 14 22:57:29 kazak systemd[1]: Failed to start MySQL Community Server.
Subject: Unit mysql.service has failed
Defined-By: systemd
Unit mysql.service has failed.
The result is RESULT.
дек 14 22:57:30 kazak systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
дек 14 22:57:30 kazak systemd[1]: mysql.service: Scheduled restart job, restart counter is at 14.
Subject: Automatic restarting of a unit has been scheduled
Defined-By: systemd
So I did this: systemctl status mysql.service And the output is this:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start) since Fri 2018-12-14 22:59:11 +06; 5s ago
Process: 14585 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 4037 (code=exited, status=0/SUCCESS); Control PID: 14594 (mysqld)
Tasks: 14 (limit: 4915)
CGroup: /system.slice/mysql.service
├─14594 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
└─14596 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid`
Does anyone knows how to fix, please?

Can't start MySQL after RHEL upgrade to 7.2, Unregistered Authentication Agent

I just upgraded my RHEL system from 6.7 to 7.2, and am having issues starting up MySQL again.
When running:
# systemctl start mysqld
I get this error:
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
systemctl status tells me the following:
● mysqld.service - SYSV: MySQL database server.
Loaded: loaded (/etc/rc.d/init.d/mysqld)
Active: failed (Result: exit-code) since Tue 2017-05-02 10:00:52 CDT; 59s ago
Docs: man:systemd-sysv-generator(8)
Process: 21827 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)
May 02 10:00:51 sa-dnca01.zs.local systemd[1]: Starting SYSV: MySQL database server....
May 02 10:00:52 sa-dnca01.zs.local mysqld[21827]: MySQL Daemon failed to start.
May 02 10:00:52 sa-dnca01.zs.local mysqld[21827]: Starting mysqld: [FAILED]
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: mysqld.service: control process exited, code=exited status=1
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: Failed to start SYSV: MySQL database server..
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: Unit mysqld.service entered failed state.
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: mysqld.service failed.
And then journalctl -xe tells me the following:
May 02 10:03:09 sa-dnca01.zs.local polkitd[768]: Registered Authentication Agent for unix-process:22276:29249716 (system bus name :1.30 [/usr/bin/
May 02 10:03:09 sa-dnca01.zs.local systemd[1]: Starting SYSV: MySQL database server....
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
May 02 10:03:10 sa-dnca01.zs.local mysqld[22281]: MySQL Daemon failed to start.
May 02 10:03:10 sa-dnca01.zs.local mysqld[22281]: Starting mysqld: [FAILED]
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: mysqld.service: control process exited, code=exited status=1
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: Failed to start SYSV: MySQL database server..
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: Unit mysqld.service entered failed state.
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: mysqld.service failed.
May 02 10:03:10 sa-dnca01.zs.local polkitd[768]: Unregistered Authentication Agent for unix-process:22276:29249716 (system bus name :1.30, object
I don't really know what any of this means, but I did have a successfully running MySQL server before the server had an OS upgrade.
Turns out I was getting this error because I hadn't created the necessary logging directory in:
/var/run/mysqld
and given it the proper permissions.
Looking at the log file in /var/log/mysqld.log led me to the issue.

Can't start mysql server

After rebooting server, I can't start mysql again
I received this message:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
I tried journalctl -xe and received this
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Unit entered failed state.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 06 21:25:57 myserver systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 06 21:25:57 myserver systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 06 21:25:58 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
here is the result for systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Sun 2016-11-06 21:29:00 UTC; 21s ago
Process: 4563 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 4560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 4563 (code=exited, status=1/FAILURE); : 4566 (mysql-systemd-s)
Tasks: 2
Memory: 320.0K
CPU: 400ms
CGroup: /system.slice/mysql.service
└─control
├─4566 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─4625 sleep 1
Nov 06 21:29:00 myserver systemd[1]: Starting MySQL Community Server...
Nov 06 21:29:01 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Please help ! Thank you!
I found out the solution after checking mysql error.log
The disk was full.