Can't create test file lower test start server mysql - mysql

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?

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

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.

If you install MySQL using the MySQL installation wizard your executable path is where you installed. It's something like "C:\Program Files\MySQL\MySQL Server 8.0\bin". Your my.init file resides in ProgramData, and path for init file may be like "C:\ProgramData\MySQL\MySQL Server 8.0". If it's can't be viewed in the location, please check whether it's hide.
As in your error description "Can't create test file C:\Program Files\MySQL\MySQL Server 5.7\data...", It seems there is no folder named 'data' in MySQL installed location. Most probably It may reside where the 'my.init' file exists (ProgramData). Else may be the name of the folder not 'data' but 'Data'.
You can copy the Data folder from the location of init-file exist and paste to the executable location. Also, change the name of the folder to data if it's capitalized.

I ran the command bin\mysqld --initialize --console and everything was solved. In some cases the data folder should be created before.
There are different parameters for windows and the rest.
See the following links:
https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html
https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html#data-directory-initialization-password-assignment
https://dev.mysql.com/doc/refman/8.0/en/option-files.html

In my case, I installed MySQL with Windows installer on the D:/ drive and was set NOT to run as Windows service.
I managed to resolve the issue by moving my.ini from C:\ProgramData\MySQL\MySQL Server 8.0 to MySQL installation folder.

This error happens to me.
The solution was edit D:\Program Files\xampp\mysql\data\my.ini and change the directory to your D: path
[mysqld]
datadir=D:\program files\xampp\mysql\data
[client]

I could solve it; I had similar issues.
C:\Program Files\MySQL\MySQL Server 8.0\bin>**mysqld --console**
2021-02-27T23:46:09.919345Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.23) starting as process 7296
2021-02-27T23:46:09.926583Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2021-02-27T23:46:09.926798Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2021-02-27T23:46:09.927086Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2021-02-27T23:46:09.933751Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-02-27T23:46:09.934110Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
The solution was that I needed to recreate the my.ini file in C:\ProgramData\MySQL\MySQL Server 8.0 and add to this:
[mysqld]
datadir=C:\ProgramData\MySQL\MySQL Server 8.0\Data
Set encoding to ANSI and saved the file.
Then the service could start:
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" MySQL80
Installing with a new MSI installer also didn't solve the issue, it kept hanging until I made the above mentioned adaptations.

In my case, the data folder did not exists, so I created one and things started working.

For xampp-portable-windows-x64-8.0.8-0-VS16
It worked by just putting at root of drive as mentioned in \ xampp \ readme_en.txt
NOTE: Unpack the package to your USB stick or a partition of your choice.
There it must be on the highest level like E:\ or W:\.
Hopes that helps

I stumbled on the same problem as mentioned at the beginning of this thread, and the trick for me was to run my console on Administrator mode (windows).
The error messages related to things like "can't find the folder" etc.., were due to the unability for the program to create, on demand, such folders and files.
Cheers

That happened to me when I try to launch the server without being in admin mode. Try relaunching console in admin mode and then navigate to the sql server 8.0 directory before trying again

Related

Error during MySQL installation - Database initialization failed

During the final step of the installation of MySQLServer (Apply Configurations), I get a strange error. I can't get it. Here's the Log :
Beginning configuration step: Initializing database (may take a long time)
Attempting to run MySQL Server with --initialize-insecure option...
Starting process for MySQL Server 8.0.31...
Starting process with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1...
'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.31) initializing of server in progress as process 13960
mysqld: File '.\??bin.index' not found (OS errno 2 - No such file or directory)
The designated data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data\ is unusable. You can remove all files that the server added to it.
Aborting
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
Process for mysqld, with ID 13960, was run successfully and exited with code 1.
Failed to start process for MySQL Server 8.0.31.
Database initialization failed.
Ended configuration step: Initializing database (may take a long time)
` ` `
What's wrong here? Please help me
you need to tick Show Advanced and Logging options, and after that you will be able to change the filename of your log-in Logging Options (all of them have to be in English).

Error during MySQL Installation ("Initializing database" Failure)

During the last steps of the installation of MySQL Community Server (Apply Configurations) in Windows 10, I get an error initializing the database. This is the Log :
Beginning configuration step: Initializing database (may take a long
time) Attempting to run MySQL Server with --initialize-insecure
option... Starting process for MySQL Server 8.0.25... Starting process
with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe
--defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1... mysqld: Can't get stat of
'C:\Users\Public\Documents\Wondershare\CreatorTemp' (OS errno 2 - No
such file or directory) 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and
'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict
mode. They will be merged with strict mode in a future release. The
designated data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data
is unusable. You can remove all files that the server added to it.
Aborting Process for mysqld, with ID 11240, was run successfully and
exited with code 1. Failed to start process for MySQL Server 8.0.25.
Database initialization failed. Ended configuration step: Initializing
database (may take a long time)
What can I do to solve this problem? Thanks.
I have the same question a few months ago and then yesterday I decided to just create the directory shown in the error log similar to yours and everything works fine now.....
All I did is I opened the command prompt, change the directory by typing: cd C:\Users\Public\Documents then enter......
After then directory has changed I then typed: mkdir Wondershare\CreatorTemp and Enter.
After I click execute in mysql installation everything works fine......

MySQL 8 W10 service works on install then won't start ater reboot

I've been going through upgrade hell changing to MySQL 8.0 on my W10 machine. Long story short, after difficulty upgrading the normal way I uninstalled the previous version and traces of it in Program Files, ProgramData, and Users[user]\Roaming\MySQL and did a fresh install of 8.0.x (latest version).
After the install the service started and worked fine. After a reboot, the service won't start and I get the "MySQL service on Local Computer has started and then stopped." error.
I have been through the fixes suggested in this thread, but the service still won't start. If I try to start the daemon manually I get:
C:\Users\boss>mysqld
2020-01-18T15:54:14.346428Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.19) starting as process 9236
2020-01-18T15:54:14.352531Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2020-01-18T15:54:14.352672Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2020-01-18T15:54:14.353206Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2020-01-18T15:54:14.368554Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-01-18T15:54:14.368725Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.19) MySQL Community Server - GPL.
There is a data folder under \ProgramData\MySQL Server 8.0 but not under \Program Files\MySQL\MySQL Server 8.0. I found another thread that suggested a fix by running mysqld --initialize but it also implied you don't need the folder under Program Files if you're running as a service, so I'm not sure this is the problem and don't want to make a change that will screw things up even more.
Can anyone advise me how to troubleshoot this?
UPDATE. Looking in the logfile I find error: "Fatal error: Could not read the column 'authentication_string' from table 'mysql.user'. Please perform the MySQL upgrade procedure." Now I think I know what happened. I installed the new version then read a dump file from the old version. That was a dump of the entire DB so when the server started and I restored this, it overwrote the mysql.user file. Question is, what can I do about this now? I can reinstall but how to I restore everything besides mysql.user from the dump file?
The last update was correct...I was overwriting the mysql files when I restored the dump. The solution was to open the dump file in an editor that could handle a file that big (NoteTab light) and delete the section containing the mysql statements.

Cannot reset root password - Windows 10

Windows force restarted on me yesterday right after setting up MySQL and popSQL, now, mySQL is telling me my password - that I know is right - is incorrect. I'm trying to reset the root password, but literally none of the guides have worked.
I've tried the official guide here, but I get a couple of errors, it does not reset the name.
The errors are:
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --init-file=C:\\mysql-init.txt
2019-02-19T16:44:49.460933Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.15) starting as process 8864
2019-02-19T16:44:49.464194Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-2DUTV5J.lower-test
2019-02-19T16:44:49.464260Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-2DUTV5J.lower-test
2019-02-19T16:44:49.464399Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2019-02-19T16:44:49.478891Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-02-19T16:44:49.479009Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
How can I fix this? I just want to reset my password.
BEFORE THE MOD MARKS THIS AS A DUPLICATE, UNLIKE THE LINKED THREADS, I'M NOT USING PHP, UNIX, XAMPP OR .BATs......... and half the links in that thread are dead. I've tried their solutions, they did not work. It's clear my issue is unique.
I've also included the 'name-installed' log file
According to the MySQL 8 docs, if you used the wizard to install MySQL, you have to specify the .ini file like this:
C:\> mysqld
--defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini"
--init-file=C:\\mysql-init.txt
There was not a need to create the data folder (however, doing so did remove some of the errors, but not all).
All you have to do is manually create data folder on C:\Program Files\MySQL\MySQL Server 8.0\ path.
I had an issue with logging in so I tried to reset the password and got this same error. From what I understood this happens because MySQL server daemon is looking for the my.ini in C:\Program Files\MySQL\MySQL Server 8.0\data\, which in my case, was not there. my.ini is originally in the Data directory in C:\ProgramData\MySQL\MySQL Server 8.0.
Try copying the whole Data directory from C:\ProgramData\MySQL\MySQL Server 8.0 into C:\Program Files\MySQL\MySQL Server 8.0\
Turned out the logging in issue I had was also due to the missing Data directory. I don't know how the Data directory went missing in the first place or whether copying the same Data directory from C:\ProgramData\MySQL\MySQL Server 8.0 would result in some kind of a clash in configuration settings later on, but to this date it all seems to be working fine. If someone knows why this happened or is there any other proper solutions for this matter, kindly let me know too

MySQL 8.0 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno 2 - No such file or directory) - can't find data for db from cmd

So, I'm looking to start a MYSQL server using CMD, and do some small simple tasks on it (hence why I'm using it that way and not a GUI)
I was told the best method for this, would be to run this command:
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --console --standalone
Which I did, however, I am getting this error:
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --console --standalone
mysqld: Can't change dir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\'
(OS errno 2 - No such file or directory)
2018-10-30T17:43:27.385678Z 0 [System] [MY-010116] [Server] C:\Program
Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.12) starting as
process 4676
2018-10-30T17:43:27.420966Z 0 [Warning] [MY-010091] [Server] Can't create
test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-
HITD28G.lower-test
2018-10-30T17:43:27.421409Z 0 [Warning] [MY-010091] [Server] Can't create
test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-
HITD28G.lower-test
2018-10-30T17:43:27.423273Z 0 [ERROR] [MY-010172] [Server] failed to set
datadir to C:\Program Files\MySQL\MySQL Server 8.0\data\
2018-10-30T17:43:27.434694Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-10-30T17:43:27.442047Z 0 [System] [MY-010910] [Server] C:\Program
Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld
8.0.12) MySQL Community Server - GPL.
I have MySQL 8.0 installed, with the server, workbench etc, but apparently the data isn't there.
Have I installed it wrongly then?
While installing MySQL 8.0 via Windows Installer, in the configuration step, the installer puts the configuration file my.ini at location C:\ProgramData\MySQL\MySQL Server 8.0 and sets the variable defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini for mysqld command.
defaults-file just points to the file from where the server reads the default configuration settings when it actually gets started. Read more here.
Now, there are actually two ways to start the server without the GUI requirement.
Method 1: Running the server using installed Windows service
Either start, stop and restart the MySQL80 service through Services app or use net commands in cmd to do the same.
(As pointed out by #nonNumericalFloat)
Method 2:
(This actually worked for me)
The MySQL80 service starts the mysqld.exe executable which actually points to the configuration file, my.ini and to the defaults-file variable as evident by the Path to executable field under the Properties tab of the service.
So using the mysqld command alone is not sufficient as it neither provides the path to the default option file needed by the server during startup which the MySQL80 service provides (as described before) nor it provides the right location of data folder (which is also specified within my.ini by datadir) . Thus, the right command to run the server is as follows:
mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console
Also, because when mysqld is used alone, it tries to find the data folder in C:\Program Files\MySQL\MySQL Server 8.0\data which actually is not present, instead of setting defaults-file, datadir can be set to point to the right data folder location using the following command:
mysqld --datadir="C:\ProgramData\MySQL\MySQL Server 8.0\Data" --console
(Similar workaround mentioned by keerthiprasath)
console parameter is used to show any error and/or status messages while the command is being executed.
Another point to note that within the my.ini file, it is specified that under "Installation Instructions",
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y).
So after copying my.ini file from C:\ProgramData\MySQL\MySQL Server 8.0 to C:\Program Files\MySQL\MySQL Server 8.0, mysqld --console alone works fine.
Note:
Commands in method 2 only works when cmd is granted with administrative privileges.
Also, PATH needs to be set for easier invocations of the MySQL programs.
I was facing the same problem; Apparently, after shutting down my server I was not able to start it anymore.
The Server itself was installed as a service - named "mysql" by default. I did not remember renaming it to something else, so I could not start the right service.
Try installing it as a service
Start cmd
Go to the "C:\Program Files\MySQL\MySQL Server 5.6\bin"
type mysqld --install
then start the service:
METHOD #1: Access the Installed Service
Open up the Services app in the Control Panel &
Scroll alphabetically to the MySQL service:
Right click the service
Click Start Service
METHOD #2: Command Line Execution
Open DOS Window From the C: Prompt and run this:
net start mysql or net start mysql57. The right name may
vary on your system
For further information on installing or removing the service check the MySQL docs.