Solved Can't initialize mysql: data directory has files in it

I have a peculiar problem when trying to run:

Code:
mysqld_safe --initialize

I get the following error in the logfile.

Code:
2021-07-11T15:50:05.6NZ mysqld_safe Logging to '/var/db/mysql1/Bahamut.err'.
2021-07-11T15:50:05.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql1
2021-07-11T15:50:05.094446Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-07-11T15:50:05.094536Z 0 [ERROR] Aborting

However, the directory is empty. Here are the steps I took to produce.

Code:
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ sudo rm -rf /var/db/mysql1
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ sudo mkdir /var/db/mysql1      
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ sudo chown -Rv mysql:mysql /var/db/mysql1                      
/var/db/mysql1
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ sudo chmod -R 775 /var/db/mysql1                              
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ ls /var/db/mysql1/
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ mysqld_safe --initialize-insecure --user=mysql --defaults-file=
/usr/local/etc/mysql/my.cnf
2021-07-11T15:54:15.6NZ mysqld_safe Logging to '/var/db/mysql1/Bahamut.err'.
2021-07-11T15:54:15.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql1
2021-07-11T15:54:15.6NZ mysqld_safe mysqld from pid file /var/db/mysql1/Bahamut.pid ended
[Amzo@Bahamut ~/freebsd-ports/science/py-tensorflow]$ cat /var/db/mysql1/Bahamut.err                
2021-07-11T15:54:15.6NZ mysqld_safe Logging to '/var/db/mysql1/Bahamut.err'.
2021-07-11T15:54:15.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql1
2021-07-11T15:54:15.655376Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-07-11T15:54:15.655463Z 0 [ERROR] Aborting

2021-07-11T15:54:15.6NZ mysqld_safe mysqld from pid file /var/db/mysql1/Bahamut.pid ended

If anyone has any ideas as to what could be causing this. Note, only using the mysql1 directory name as I tried to see if a new directory would fix it.
 
Probably some hidden files in there, like .snap or .zfs.
 
Back
Top