9

First, I'm not a backend person.

I had a running instance of mysql on my ubuntu server. I was able to log in, run some basic queries, everything was fine.

I stopped the service and started futzing around trying to get mysql to boot up in --skip-grant-table mode so I could import an older dump file that would then need to be upgraded. I tried various commands such as mysqld --skip-grant-tables and other all quite likely betraying that I'm not quite sure what I'm doing and the documentation is nearly impossible to locate. I've been trying to follow the instructions here.

Read: Highly irritated at this point.

Now I can't even start the service anymore and I get this series of warnings followed by this series of errors:

017-08-04T07:23:17.065571Z 0 [Warning] Can't create test file /var/lib/mysql/hq-lampsvr.lower-test
2017-08-04T07:23:17.065614Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.19) starting as process 12175 ...
2017-08-04T07:23:17.068092Z 0 [Warning] Can't create test file /var/lib/mysql/hq-lampsvr.lower-test
2017-08-04T07:23:17.068122Z 0 [Warning] Can't create test file /var/lib/mysql/hq-lampsvr.lower-test
…
2017-08-04T07:23:17.092298Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-08-04T07:23:17.092320Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-08-04T07:23:17.092325Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
…

What am I doing wrong, how can I get mysql to boot up again and does anyone know how to get this "safe mode" mysql type thing to boot up because nothing in the mysql docs is working. Working from clean installs of everything.

Ubuntu: 16.04
Mysql: 5.7.19

motleydev
  • 233
  • 1
  • 3
  • 5
  • You need to ensure that the user that MySQL daemon uses, has write access to the `/var/lib/mysql` directory, and all files are owned by that user. – Tero Kilkanen Aug 04 '17 at 14:35

3 Answers3

9

You can try this code:

chown -R mysql:mysql /var/lib/mysql
2

i have a same problem, and solve this after edit this file /etc/apparmor.d/local/usr.sbin.mysqld and see this link

https://askubuntu.com/questions/758898/mysql-wont-start-after-changing-the-datadir-14-04-mysql-5-7/795710#795710

maybe help you

1

When I got the same error, I opened a DOS prompt and go to the MySQL bin\ directory and issue the below command to know what is causing the issue:

..\bin > mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --standalone --console

it showed me errors e.g.

[ERROR] [MY-012611] [InnoDB] Operating system error number 32 in a file operation.

[ERROR] [MY-012615] [InnoDB] The error means that another program is using InnoDB's files. This might be a backup or antivirus software or another.

So the antivirus was locking the files (error may be different in your case), When I ran the above command again, this time mysql started as standalone.

There are few other points to note -

  • MySQL will stop when you will close the console. So for running it permanently, mysql should be started as service after fixing the error.
  • In windows, several times mysql service show as stopped but it unable to start because still process is in use (don't know why). So restarting the server fix this problem.