ERROR 1794 (HY000): Slave is not configured or failed to initialise properly
Step to fix below Error:
ERROR 1794 (HY000): Slave is not configured or failed to initialize properly. You must at least set –server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.
Check InnoDB basic tables list.
mysql> select table_name from information_schema.tables where table_schema='mysql' and engine='InnoDB'; +----------------------+ | table_name | +----------------------+ | innodb_index_stats | | innodb_table_stats | | slave_master_info | | slave_relay_log_info | | slave_worker_info | +----------------------+ 5 rows in set (0.00 sec)Normally ibdata01 will store this 5 tables in the databases, if you cant see that you have 5 tables in the list mean that your mysql have some problem.
Way to fix the error.
Initial your mysql again with below step.
Delete your logbin directory/* and data directory/*
5.6 and older version initial step
Confirm that mysql are stop
1service mysql stop
Confirm data directory dont have any data, and the datadir please set in the my.cnf.
1rm
-rf
/opt/mysqldata/data/*
2rm
-rf
/opt/mysqldata/logbin/*
Executes initial scripts, dont forget to setup your my.cnf nicely before you run this command.
1usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/opt/mysqldata/data --user=mysql
Start mysql.
1service mysql start
Initial Password
1/usr/local/mysql/bin/mysqladmin
-u root password
'newpassword'
#Try to login
1/usr/local/mysql/bin/mysql
-uroot -p
'newpassword'
5.7 and higher version method to initial databases.
Make sure mysql has stop.
1service mysql stop
Confirm data directory dont have any data, and the datadir please set in the my.cnf.
1rm
-rf
/opt/mysqldata/data/*
2rm
-rf
/opt/mysqldata/logbin/*
Executes initialize command, remember default-file has to be in the first.
1mysqld --defaults-file
=
/usr/local/mysql/my.cnf
--initialize
5.7 initial has use new method. but its make it more secure.
Program will automatic generate new password, you have to be login with this password.
or you can changes from –initialize to –initialize-insecure, so you can login without password.
Password will be at the last line of the initial process.
Password will be inside mysql.err, if my datadir are located in /data/mysql/data, then my password will be in /data/mysql/data/mysql.err.
12sed
-n
'/password/p'
/data/mysql/data/mysql
.err
.....A temporary password is generated
for
root@localhost: GVedtgXDZ1-,
Confirm the file permission are set to mysql
1chown
-R mysql:mysql
/data/mysql/data/
Start mysql
1service mysql start
Login to the mysql
1mysql -uroot -p
'GVedtgXDZ1-,'
Manually changes your root password, if not it will keep prompt you to changes new password.
1234mysql> alter user
'root'
@
'localhost'
identified by
'123'
;
mysql>
set
password
for
'root'
@
'localhost'
=password(
'123'
);
mysql> update mysql.user
set
authentication_string=password(
'123'
) where user=
'root'
and Host =
'localhost'
;
mysql> flush privileges;
Test login with your new password.
1mysql -uroot -p
'123'
Mysql 5.7 can set password lifetime like below:
123ALTER USER
'root'
@
'localhost'
PASSWORD EXPIRE INTERVAL 90 DAYS;
ALTER USER
'root'
@
'localhost'
PASSWORD EXPIRE NEVER;
ALTER USER
'root'
@
'localhost'
PASSWORD EXPIRE DEFAULT;
Leave a Reply
Want to join the discussion?Feel free to contribute!