相关文章推荐

Stack Exchange Network

Stack Exchange network consists of 182 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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]
                Use "Generic Instructions" procedure from dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
– Akina
                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
                Dec 17, 2021 at 10:30
  • Delete Data folder present inside C:\Program Files\MySQL\MySQL Server 8.0

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

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

  • 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

    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 Dec 17, 2021 at 10:32
  •  
    推荐文章