The OS is Ubuntu 18.04. The Mysql is 8.0.24 community server.
My data directory is shown below:
mysql> show variables like '%datadir%';
+---------------+--------------+
| Variable_name | Value |
+---------------+--------------+
| datadir | /data/mysql/ |
+---------------+--------------+
1 row in set (0.01 sec)
The basename and index of my binlog:
mysql> show variables like 'log_bin%';
+---------------------------------+-------------------------------+
| Variable_name | Value |
+---------------------------------+-------------------------------+
| log_bin | ON |
| log_bin_basename | /data/mysql/binlogs |
| log_bin_index | /data/mysql/mysqlmaster.index |
| log_bin_trust_function_creators | OFF |
| log_bin_use_v1_row_events | OFF |
+---------------------------------+-------------------------------+
5 rows in set (0.01 sec)
The content of my.cnf:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
#validate_password
validate_password.policy=1
validate_password.length=8
validate_password.number_count=1
validate_password.mixed_case_count=1
validate_password.special_char_count=1
validate_password.check_user_name=1
#datadir
datadir = /data/mysql
#binlog
log_bin = binlogs
log_bin_index = mysqlmaster.index
server_id = 100
Now I want to set
log_bin = /data/mysql/binlogs/mysqlmaster
log_bin_index = /data/mysql/binlogs/mysqlmaster.index
But When I configure this content in my.cnf:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
#validate_password
validate_password.policy=1
validate_password.length=8
validate_password.number_count=1
validate_password.mixed_case_count=1
validate_password.special_char_count=1
validate_password.check_user_name=1
#datadir
datadir = /data/mysql
#binlog
log_bin = /data/mysql/binlogs/mysqlmaster
log_bin_index = /data/mysql/binlogs/mysqlmaster.index
server_id = 100
Then I start mysql server :
it@mysqlmaster:~$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
The command "journalctl -xe" show:
it@mysqlmaster:~$ journalctl -xe
-- Unit mysql.service has failed.
--
-- The result is RESULT.
May 01 00:32:24 mysqlmaster systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
May 01 00:32:24 mysqlmaster audit[11816]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" nam
May 01 00:32:24 mysqlmaster kernel: audit: type=1400 audit(1619829144.154:234): apparmor="STATUS" operation="profile_replace" info="same as current profile,
May 01 00:32:24 mysqlmaster systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 01 00:32:24 mysqlmaster systemd[1]: mysql.service: Failed with result 'exit-code'.
May 01 00:32:24 mysqlmaster systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
May 01 00:32:32 mysqlmaster sudo[11467]: pam_unix(sudo:session): session closed for user root
May 01 00:32:34 mysqlmaster sudo[11829]: it : TTY=pts/0 ; PWD=/home/it ; USER=root ; COMMAND=/usr/sbin/service mysql start
May 01 00:32:34 mysqlmaster sudo[11829]: pam_unix(sudo:session): session opened for user root by it(uid=0)
May 01 00:32:35 mysqlmaster systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
May 01 00:32:35 mysqlmaster audit[11909]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" nam
May 01 00:32:35 mysqlmaster kernel: audit: type=1400 audit(1619829155.626:235): apparmor="STATUS" operation="profile_replace" info="same as current profile,
May 01 00:32:36 mysqlmaster systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 01 00:32:36 mysqlmaster systemd[1]: mysql.service: Failed with result 'exit-code'.
May 01 00:32:36 mysqlmaster systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
May 01 00:32:36 mysqlmaster sudo[11829]: pam_unix(sudo:session): session closed for user root
So my question is if i want to set:
log_bin = /data/mysql/binlogs/mysqlmaster
log_bin_index = /data/mysql/binlogs/mysqlmaster.index
What should I add to my.cnf to achieve my goal?
Now I slove my question:
Then I do this:
Now it's OK :