0

I tried resetting mySql password using official documentation but its not working,

https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/resetting-permissions-windows.html

its giving me error

[![C:\Program Files\MySQL\MySQL Server 8.0>mysqld --init-file=C:\\mysql-init.txt --console
2021-12-16T18:33:22.801467Z 0 \[System\] \[MY-010116\] \[Server\] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.26) starting as process 14656
2021-12-16T18:33:22.803505Z 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-12-16T18:33:22.803577Z 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-12-16T18:33:22.803754Z 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-12-16T18:33:22.804645Z 0 \[ERROR\] \[MY-010119\] \[Server\] Aborting
2021-12-16T18:33:22.804771Z 0 \[System\] \[MY-010910\] \[Server\] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.26)  MySQL Community Server - GPL.][1]][1]
4
  • Sounds like you are running the install without using the admin account
    – RiggsFolly
    Commented Dec 16, 2021 at 18:35
  • There are numerous duplicates of this question at Database Administrators
    – Barmar
    Commented Dec 16, 2021 at 18:36
  • Use "Generic Instructions" procedure from dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
    – Akina
    Commented Dec 17, 2021 at 10:27
  • its giving me error Have you logged as Administrator? Does this Administrator Windows account have permissions for to create files in the @@datadir forder? Have you started the console where you tries to start mysqld.exe using "Run as Administrator" in the context menu of cmd.exe?
    – Akina
    Commented Dec 17, 2021 at 10:30

1 Answer 1

0

For windows 10

  1. Delete Data folder present inside C:\Program Files\MySQL\MySQL Server 8.0

  2. Create file named mysql-init.txt and copy paste below lines and store at C:\

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

  3. Open CMD as admin cd to path C:\Program Files\MySQL\MySQL Server 8.0\bin> and enter following commands one by one

mysqld -install

mysqld --initialize

mysqld --init-file=C:\\mysql-init.txt --console

1
  • Delete Data folder present inside C:\Program Files\MySQL\MySQL Server 8.0 - there is no such folder if default install settings were used during MySQL installation.
    – Akina
    Commented Dec 17, 2021 at 10:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.