Reputation: 1
T he version installed on my machine.Details as follows:
mandar@~:$ mysql --version mysql Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
mysql is running ---
mandar@~:$ sudo systemctl status mysql ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2023-01-11 12:53:58 IST; 7min ago Process: 180517 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 180525 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 37674) Memory: 364.3M CPU: 2.622s CGroup: /system.slice/mysql.service └─180525 /usr/sbin/mysqld
Jan 11 12:53:56 coeus systemd[1]: Starting MySQL Community Server... Jan 11 12:53:58 coeus systemd[1]: Started MySQL Community Server.
mandar@~:$ sudo mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I am not able to get mysql prompt .. I have not set any password .
mandar@~:$ sudo mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I have tried to start sql in safe mode using following command
sudo mysqld_safe --skip-grant-tables &
Error Message mandar@~:$ 2023-01-11T06:19:33.781251Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2023-01-11T06:19:33.782132Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists. I also tried to complete the secure installation
mandar@~:$ sudo mysql_secure_installation [sudo] password for mandar:
Securing the MySQL server deployment.
Enter password for user root: Error: Access denied for user 'root'@'localhost' (using password: YES)
mandar@~:$ mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) what am I doing wrong ?
Upvotes: 0
Views: 42
Reputation: 458
If you haven't set the password and the username is root try
mysql -u root -p
it will ask for password press enter without typing anything, if you are using ubuntu:
sudo mysql -u root -p
You can follow the Digital Ocean Tutorial for step by step installation guide.
Upvotes: 1