title: MySQL installed with homebrew stopped working
body: <p>I'm running Laravel with Valet on localhost. The other day my DB stopped working and I got this error.</p>
  
  <p>I've tried varies solutions from StackOverlfow but nothing seems to work for good.
  I had some success with re-installing MySQL. First it worked, then after a restart the error returned as if nothing had happened.</p>
  
  <p>Any ideas and possible solutions are welcome!</p>
  
  <pre><code>2019-11-22T07:28:20.732087Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
  2019-11-22T07:28:20.833268Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:21.834984Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:22.838856Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:23.844548Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:24.848946Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:25.849871Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:26.854401Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:27.859471Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:28.862669Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:29.867559Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:30.868884Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:31.873861Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:32.878402Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:33.882308Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:34.885179Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:35.887673Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:36.890348Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:37.894877Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:38.900421Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:39.904220Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:40.909429Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:41.913230Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:42.918485Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:43.923973Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:44.927397Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:45.931041Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:46.935998Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:47.941222Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:48.943928Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:49.945988Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:50.950217Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:51.955518Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:52.960605Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:53.965354Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:54.970208Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:55.976164Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:56.982518Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:57.984856Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:58.987334Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:28:59.990658Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:00.995798Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:01.997097Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:02.999242Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:04.005513Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:05.010475Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:06.014483Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:07.020468Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:08.026727Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:09.029067Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:10.033853Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:11.036066Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:12.041863Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:13.045891Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:14.050010Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:15.055826Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:16.062497Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:17.068520Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:18.074686Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:19.081226Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:20.084656Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:21.086282Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:22.089582Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:23.095008Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:24.098510Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:25.101950Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:26.108228Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:27.116696Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:28.123539Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:29.129444Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:30.135448Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:31.140923Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:32.144339Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:33.150813Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:34.156732Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:35.160435Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:36.165699Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:37.172622Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:38.180502Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:39.184494Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:40.188930Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:41.192453Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:42.196437Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:43.198767Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:44.206068Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:45.212700Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:46.216042Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:47.222179Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:48.227701Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:49.234171Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:50.236459Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:51.241873Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:52.245806Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:53.249358Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:54.254697Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:55.262889Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:56.269719Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:57.276984Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:58.283896Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:29:59.287215Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:30:00.291169Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:30:01.297730Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
  2019-11-22T07:30:01.301008Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 35 in a file operation.
  2019-11-22T07:30:01.302042Z 1 [ERROR] [MY-012596] [InnoDB] Error number 35 means ‘Resource temporarily unavailable’
  2019-11-22T07:30:01.304279Z 1 [ERROR] [MY-012215] [InnoDB] Cannot open datafile ‘./ibdata1’
  2019-11-22T07:30:01.305396Z 1 [ERROR] [MY-012959] [InnoDB] Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
  2019-11-22T07:30:01.306751Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Cannot open a file.
  2019-11-22T07:30:01.308318Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
  2019-11-22T07:30:01.309340Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
  2019-11-22T07:30:01.310976Z 0 [ERROR] [MY-010119] [Server] Aborting
  2019-11-22T07:30:01.311578Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.18_1/bin/mysqld: Shutdown complete (mysqld 8.0.18)  Homebrew.```
  </code></pre>