Failed to setup server and failed to connect to the specified database

@sahilm0704 please check with shell and check if your able to login into mysql using the root password. If not you will have to reset the password since you have forgotten it. Please follow these steps to reset the forgotten root password

To change the MySQL root password, you first need to shut down the MySQL server, and you can do so using the command: sudo systemctl stop mysql.service

Skip Grant Tables & Networking

sudo systemctl set-environment MYSQLD_OPTS=“–skip-networking --skip-grant-tables”

Start the MySQL service

sudo systemctl start mysql.service

Sign In to the MySQL shell

Now, you need to login as a root user to the MySQL server and for signing in to the MySQL shell, type the command: sudo mysql -u root

Select the MySQL database. use mysql

Now ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘the-new-password’;

Then: flush privileges; That’s all exit mysql shell and try logging in again. sudo mysql -uroot -p If successful please use the same information while setting up the server

1 Like