Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create test file lower test start server mysql

Tags:

I'm following this tutorial here on creating a JDBC programming. I've followed the steps up to the console command to start the server:

// For Windows  cd {path-to-mysql-bin}   // Check your MySQL installed directory mysqld --console 

I get the following error message:

mysqld: Can't change dir to 'C:\Program Files\MySQL\MySQL Server 5.7\data\' (Errcode: 2 - No such file or directory) 2017-01-06T10:54:36.968210Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-01-06T10:54:36.968210Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2017-01-06T10:54:36.968210Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 11248 ... 2017-01-06T10:54:36.974226Z 0 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.7\data\DESKTOP-DEQ2IC2.lower-test 2017-01-06T10:54:36.975229Z 0 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.7\data\DESKTOP-DEQ2IC2.lower-test 2017-01-06T10:54:36.975229Z 0 [ERROR] failed to set datadir to C:\Program Files\MySQL\MySQL Server 5.7\data\ 2017-01-06T10:54:36.976231Z 0 [ERROR] Aborting  2017-01-06T10:54:36.977234Z 0 [Note] Binlog end 2017-01-06T10:54:36.978237Z 0 [Note] mysqld: Shutdown complete 

I'm quite new to using MySql in this way but I can see that there is no data folder in the server directory and no my.ini file which I assumes holds the config information on where the data directory is. I've also insntalled MySql using the windows installer which I've read could be why there is no my.ini file and just a template my-default.ini file.

Does anyone know why this is happening?

like image 717
Fane Fonseka Avatar asked Jan 06 '17 11:01

Fane Fonseka


People also ask

Can't create test file MySQL lower test?

To sum it up, the can't create test file is not an actual error since it's marked with a [WARNING] sign in the console. But the warning usually means you may have a problem with MySQL datadir folder configuration. You need to check the actual error message that's marked with [ERROR] in the console to fix the issue.

What does Mysqld command do?

mysqld, also known as MySQL Server, is a single multithreaded program that does most of the work in a MySQL installation. It does not spawn additional processes. MySQL Server manages access to the MySQL data directory that contains databases and tables.

Can't connect to local MySQL server on localhost?

normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.


2 Answers

Create a data folder in C:\Program Files\MySQL\MySQL Server 8.0.

Create a new file with

(ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';)  

command for password reset (if required)

Make sure that your file is in C: drive. root folder.

Then execute the below command:

C:\> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin" C:\> mysqld --init-file=C:\\mysql-init.txt 
like image 189
Senthil Nathan Avatar answered Sep 21 '22 09:09

Senthil Nathan


As mentioned above, create a "data" folder, (for me after that it didn't show errors, but it wasn't stills starting).
After that, go to services.msc in windows and start it from there. Also set it to Automatic so it starts automatically whenever you start the windows. It worked for me.

like image 21
Ali Avatar answered Sep 20 '22 09:09

Ali