无法在mysql

时间:2017-11-04 08:26:00

标签: mysql my.cnf

我想在ubuntu服务器上创建主从复制。 不同服务器上的(主服务器和从服务器)。 我在master上制作了my.cnf(没有coments)文件:

!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

然后我重新启动使用sudo service mysql restart并得到以下错误:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details

但是当我设置bind-address = 127.0.0.1时,它工作正常。

下面是使用的引用,其中bind-address应该是主服务器的地址

https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

但它与下面的链接相符,其中说(在评论部分下)bind-address是奴隶的ip

https://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html

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 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 说:

-- 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

1 个答案:

答案 0 :(得分:0)

  

下面是使用的引用,其中bind-address应该是主服务器的地址

不,不。它说“用服务器的IP地址替换标准IP地址”。 “主人”这个词没有出现。

  

但它与下面的链接相符,其中说(在评论部分下)bind-address是奴隶的ip

不,不。它说'你必须确保 slave的地址或主机名与bind-address设置相匹配'。

您无法绑定到非本地IP地址。