mysql doesn't ask for root password when installing

situation

  • I did install MySQL by using a MySQL installer and I did fill out the content as following MySQL did ..but not asked a password ..

try

Anyway I tried to start mysql set-up in the command prompt..

  1. cd C:\Program Files\MySQL\MySQL Server 8.0\bin

  2. mysql -u root -p

  3. error (without password )

environment

  • windows10 64 bit

  • I installed mysql-installer-web-community-8.0.22.0.msi

Besides, I've ever used Xampp and Local before for WordPress development ..

I did install when setup

・Mysql Server (latest version)

・Mysql workbranch(latest version)

・mysql Shell (latest version)

・mysql for visual studio (latest version)

Error content

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

my goal

  • I want to use MySQL in the visual studio with laravel ..

2 Answers

MySQL by default sets the username to root and there’s no password. You can now run mysql -u root -p and be logged in without a password. Unfortunately, some applications and services that depend on MySQL will fail if a root password is needed for authentication.

The following method will allow you set a password, or reset it if one was defined and forgotten.

  • Run the Services applet (services.msc)

  • Find the MySQL service, right-click that entry, then click Stop

  • Create a text file containing this one line with any name, but here I will call it mysql-init.txt(replace "NewPassword" but keep everything else):

     ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
  • Run the Command Prompt (cmd.exe) as Administrator

  • Navigate to the MySQL folder by a command similar to the following (version number may change):

     cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
  • Enter the following using two slashes for each slash (\\):

     mysqld --init-file=C:\\path\\mysql-init.txt
  • Now you may log into the MySQL server as root using the new password, after restarting the MySQL service. The file mysql-init.txt is no longer needed.

For more details see the articleHow to Reset or Change MySQL Root Password on Linux or Windows.

1
  1. Open MySQL-Installer Community usind Windiws + R (Serach here for MySQL installer community)
  2. Click on Reconfigure which is next to MySQL server

enter image description here

  1. Click Next

enter image description here

  1. Click Next

enter image description here

  1. Add new passwordenter image description here
  1. Click Next => Next => Execute
  2. Its done

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like