0

I know there are countless questions and posts about this, but I'm getting an error when trying to start the MySQL Server and I don't know how to solve it.

So to explain I cannot access my database so I tried to reset the password of the root user. I've followed this guide however I've had no luck. First I had issues with permissions on my machine and now I'm getting this error:

1105 Bootstrap file error, return code (0). Nearest query: ''

Technically the MySQL Server is starting, however the init-file is not being run, and so my password is not being reset.

Command I am running is this:

mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\my.ini" --init-file=C:\\mysql-init.txt --console

Contents of mysql-init.txt

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

The following is the part of the log where the error is shown:

[Note] Execution of init_file 'C:\\mysql-init.txt' started. [ERROR] 1105 Bootstrap file error, return code (0). Nearest query: '' [Note] Execution of init_file 'C:\\mysql-init.txt' ended. [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe: ready for connections.

MySQL Version: 5.7

OS: Windows 10

Daniel Grima
  • 2,765
  • 7
  • 34
  • 58
  • I managed to get around this issue by adding --skip-grant-tables in my.ini file (https://stackoverflow.com/a/11013868/2312637). That allowed me to log into MySQL through command line without a password. I than ran flush privileges and reset the password. – Daniel Grima Jan 27 '18 at 16:27

3 Answers3

1

Actually you can pass the command:

--init-file=C:\\mysql-init.txt

as a parameter to start the MySQL service from its general tab.

(Source)

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Langelius
  • 11
  • 2
1

Had two errors with MySQL 5.7.24

1.) The script file must be in a separate folder (not mysql installation folder or data directory) and that folder must get "secure-file-privileges"

2.) The error above was raised for the script did not end with a ';'

Succeeded then with command line statement as

mysqld --datadir=D:\ProgramData\mysql\data --init-file=D:\ProgramData\mysql\reset\reset.sql --secure-file-priv=D:\ProgramData\mysql\reset --console

and SQL-script file 'reset.sql' as

alter user 'root'@'localhost' identified by 'root_pwd';
Sam Ginrich
  • 661
  • 6
  • 7
1

For me, on Ubuntu, problem was init file was not owned by mysql user.

chown mysql:mysql /tmp/reset_mysql_pswd.sql
sudo mysqld --init-file=/var/lib/mysql/reset_mysql_pswd.sql
# ^C or kill -9 <mysqld pid>
systemctl stop mysql.service
systemctl start mysql.service

Even when the folder containing the init file and the init file itself had permissions 777 (which is a bad idea), I still get:

2020-04-10T23:14:48.030719Z 0 [Note] Execution of init_file '/tmp/reset_mysql_pswd.sql' started.
2020-04-10T23:14:48.030764Z 0 [ERROR] mysqld: File '/tmp/reset_mysql_pswd.sql' not found (Errcode: 13 - Permission denied)
2020-04-10T23:14:48.030772Z 0 [ERROR] Aborting
Kashyap
  • 15,354
  • 13
  • 64
  • 103