Secure MySQL 8 installation on Ubuntu 20.04 Problem - mysql

I`m trying to install and configure mysql and phpmyadmin, but after installation mysql-server, when I try to use command mysql_secure_installation terminal ask me to input root password. After entering, it shows ERROR:
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I tried install mysql with info from this page https://kifarunix.com/install-mysql-8-on-ubuntu-20-04/
Edit:
https://www.hivelocity.net/kb/what-to-do-if-mysql-sock-file-is-missing/ That didn`t help

Related

Homebrew - brew mysql 8 - Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I tried a lot to install MySQL8 via Homebrew on Mac 10.14.5. I was running MySQL 5.7 before that and did the following: I removed MySQL completely via this tutorial: https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks
After that I run mysql and got the message that the command was not known. So I installed mysql with brew install mysql. After installation I did brew link --force mysql and got Warning: Already linked: /usr/local/Cellar/mysql/8.0.19
I edited /usr/local/etc/my.cnf and added default-authentication-plugin=mysql_native_password in the [mysqld] section. After that I restartet the service using brew services restart mysql
brew services list shows me this now:
mysql started root /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
mysql#5.7 stopped
However, when I type mysql in the terminal I get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
The /tmp/mysql.sock does not exist.
When I change the host in the my.cnf file from localhost to 127.0.0.1 this error will change into this:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 54
Anyone has an idea what's going on here and how I can fix it? I also googled it and found various Threads, some are saying that the permissions must be changed to this sudo chown -R _mysql:mysql /usr/local/var/mysql but this does not change anything in my case.

How to connect to myslqd.socket?

After looging in to my ubuntu machine, I try to login to my database using the following command in the shell:
mysql --user=root -p
Then I get the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).
What I have tried:
Uninstall and reinstall -> same error afterward.
sudo service mysql start -> Job for mysql.service failed.
Used configuration template in my.cnf (which is /etc/mysql for Linux).
search for mysqld.sock -> The system doesn't find.
Does anybody have another solution that I could try? Thanks!
I was able to connect to SQL by getting another droplet at digital ocean. I install SQL in the new droplet and worked like a charm. I don't understand why the other droplet was giving me that error. Thanks everyone.

MySQL on MacOS installed by brew not working after shutdown

I install on my MacOS Sierra long time ago MySQL using brew install mysql and everytime I turn off and on my computer mysql started automagicaly what was great. But unfortunately yesterday I needed to temporarily shutdown MySQL - so I found on internet some command (but it was not brew services stop mysql) and after that when I reboot my computer MySQL not started (I was unable to connect by Sequel Pro GUI MySQL client). So I try to run it by:
brew services start mysql
==> Successfully started `mysql` (label: homebrew.mxcl.mysql)
But I was still unable to connect :(
I try to connect by following command (to change root password) and get hint:
Mac-mini-Kamil:local Kamil$ mysqladmin -u root password 'xxxx'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
I type this 'hint' to internet and find out that I need run the following command:
mysqld
And that works :) (I was able to connect to my db)

How to install mysql server and xampp server both in same operating system

In my machine there has Xampp server. Recently I install MySQL server edition on that machine. It occurs an error. Then change port and socket in config.inc.php page. Again it shows an error. to solve uninstall both Xampp server and MySQL. Again try to run both Xampp and MySQL both. First install Xampp then install mySQL work bench. Now it shows an errors [ #1142 - SELECT command denied to user ''#'localhost' for table 'pma_recent' and (SELECT tables
FROM phpmyadmin.pma_recent WHERE username = 'root' )].
Please help me to solve this problem. and tell me the procedure without conflict database,how to install both xampp server and mysql server.
You can install xampp in port 3306 and mySql in port 3307.

PHPMyAdmin cannot connect to MySQL

I installed the lampp sever on my local in linux OS,
but its giving error while opening phpmyadmin.
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
See services mysqld enabled or disabled.
check if MySQL is running with this command
mysqladmin -u root -p status
if it is running it will ask for your password otherwise it will spit out an error