First I did
debian@osboxes:~/Desktop$ mysql -u root -p
Command 'mysql' not found, but can be installed with:
sudo apt install mysql-client-core-8.0 # version 8.0.18-0ubuntu0.19.10.1, or
sudo apt install mariadb-client-core-10.3 # version 1:10.3.20-0ubuntu0.19.10.1
then I installed
debian@osboxes:~/Desktop$ sudo apt install mysql-client-core-8.0
Now I do
debian@osboxes:~/Desktop$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
So now I check
debian@osboxes:~/Desktop$ sudo service mysql status
Unit mysql.service could not be found.
then I do
debian@osboxes:~/Desktop$ ps aux | grep mysql
debian 4379 0.0 0.0 8896 916 pts/0 S+ 14:38 0:00 grep --color=auto mysql
so it seems mysql service is running. but when I Try to login now
debian@osboxes:~/Desktop$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
debian@osboxes:~/Desktop$
I also tried.
debian@osboxes:~/Desktop$ systemctl restart mysql
Failed to restart mysql.service: Unit mysql.service not found.
debian@osboxes:~/Desktop$ sudo dpkg -l | grep -E 'mysql'
ii libmysqlclient21:amd64 8.0.18-0ubuntu0.19.10.1 amd64 MySQL database client library
ii mysql-client-core-8.0 8.0.18-0ubuntu0.19.10.1 amd64 MySQL database core client binaries
ii mysql-common 5.8+1.0.5ubuntu2 all MySQL database common files, e.g. /etc/mysql/my.cnf
debian@osboxes:~/Desktop$
Last week I had asked question mysql does not start after a reboot so I know I had installed mysql on this machine in problem. But still I face the problem so tried
debian@osboxes:~/Desktop$ sudo apt-get install mysql-server
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 4531 (unattended-upgr) - open (11: Resource temporarily unavailable)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
I also checked
debian@osboxes:~/Desktop$ systemctl -a | grep -iE 'mysql'
there was no output. Also I do
debian@osboxes:~/Desktop$ sudo netstat -tap | grep mysql
sudo: netstat: command not found
then I do
debian@osboxes:~/Desktop$ sudo apt-get install net-tools
debian@osboxes:~/Desktop$ sudo netstat -tap | grep mysql
No output.
Now based on comments below I did
debian@osboxes:~/Desktop$ sudo rm /var/lib/dpkg/lock
debian@osboxes:~/Desktop$ sudo dpkg --configure -a
debian@osboxes:~/Desktop$ sudo systemctl restart mysql.service
Failed to restart mysql.service: Unit mysql.service not found.
Now try
debian@osboxes:~/Desktop$ sudo rm /var/cache/apt/archives/lock
Now I reboot and then
debian@osboxes:~/Desktop$ ps aux | grep mysql
debian 2403 0.0 0.0 8896 844 pts/0 S+ 15:10 0:00 grep --color=auto mysql
debian@osboxes:~/Desktop$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
It is taking root password which I tried last week. I am not able to understand what should I check. I can't login. What should I check now? I am on Ubuntu 19.10
E: Could not get lock
issue - take a look here – Yaron Jan 14 '20 at 09:29sudo systemctl restart mysql.service
? – Yaron Jan 14 '20 at 09:30failed to restart mysql.service: Unit mysql.service not found. debian@osboxes:~/Desktop$
– political science Jan 14 '20 at 09:31Failed to restart mysql.service: Unit mysql.service not found.
seems to indicate that there is a problem with mysql server, if it was install on your machine – Yaron Jan 14 '20 at 09:31E: Could not get lock
issue - take a look here it should help you – Yaron Jan 14 '20 at 09:32