Can't login to MySQL after upgrade to Lion - mysql

After upgrading to Lion I can still start MySQL via System Preferences -> MySQL
When I try and login with the root user and password I was using on Snow Leopard I get this error via phpMyAdmin
#2002 Cannot log in to the MySQL server
Via the MySQL Query Browser however I get code 2003
If I try via Terminal with mysql -u root -p I get the error
-bash: mysql: command not found
Thanks for any help.

There was a problem with the socket and I had to change occurences of /var/mysql/mysql.sock to /tmp/mysql.sock as stated here http://birdchan.com/home/2011/07/20/osx-lion-mysql-sock-path/

Related

How to setup MySQL on MacOS (Getting Started)

I have been running all my apps with Rails and PostgreSQL, which was very easy to setup using brew install postgresql and brew services start postgresql. With MySQL is proving to be a very big pain.
How do I setup MySQL from 0 and clean up all the mess I made?
I have downloaded MySQL Community Server 8.0.21 on my MacOS and registered a root password during the setup.
After that I have run the folowing commands that render the following errors.
$ mysql -u root -p
# ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
$ mysql.server start
# Starting MySQL
# ./usr/local/Cellar/mysql/8.0.21_1/bin/mysqld_safe: line 144: /usr/local/var/mysql/Victors-MBP.err: Permission denied
# /usr/local/Cellar/mysql/8.0.21_1/bin/mysqld_safe: line 144: /usr/local/var/mysql/Victors-MBP.err: Permission denied
# /usr/local/Cellar/mysql/8.0.21_1/bin/mysqld_safe: line 199: /usr/local/var/mysql/Victors-MBP.err: Permission denied
# /usr/local/Cellar/mysql/8.0.21_1/bin/mysqld_safe: line 144: /usr/local/var/mysql/Victors-MBP.err: Permission denied
# ERROR! The server quit without updating PID file (/var/run/mysql/mysqld.pid).
$ brew doctor
$ brew uninstall mysql
$ brew cleanup
$ brew install mysql
# The whole setup works, but every attempt to run the server still renders the same errors.
$ mysql_secure_installation
# after inputting the correct root password...
# Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
Please help. I have tried many more different setups and corrections, none of which have worked.
Thank you in advance!
MySQL has a simple Macintosh installer and a control-panel that goes along with it ... shows up in "System Preferences." Are you sure that the server is actually running? Betcha it ain't.
This worked: https://superuser.com/a/603027/1220403
Basically execute this command:
$ mysql -u root mysql
And you'll be able to set a password using ALTER USER and access the mysql command line. Also, you'll be able to start the server.

Secure MySQL 8 installation on Ubuntu 20.04 Problem

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

Cannot get MySQL running in Terminal on macOS Sierra

I have been setting up a new laptop for development purposes and when trying to get MySQL to run in the Terminal I get the following message:
$ mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Can somebody please help me out here?
You may get this error because mysql server is not started. For me it solved only by starting mysql server.
to start Mysql server (for Mac OS X), command line in terminal:
sudo /usr/local/mysql/support-files/mysql.server start
or, simply go to your Mac System Preference --> MySQL --> click on start mysql..

Mysql on Ubuntu: ERROR 1045 (28000)

I've installed mysql server on my Ubuntu 16.04 using this command:
user#samariter-ubuntu:~/dev$ sudo apt-get install mysql-server
I left the "root" pass blank. It went fine, no objections. However, when I try to start it, it refuses:
user#samariter-ubuntu:~/dev$ mysql
ERROR 1045 (28000): Access denied for user 'sasa'#'localhost' (using password: NO)
I must start it with sudo. Why is that? How can I solve it?
sudo service mysql-server : Install mysql server as a service. It downloads mysql server latest version available from apt repository.
sudo service mysql status : Check the status of your service
sudo service mysql start : start mysql server
sudo service mysql stop : stop mysql server
sudo service mysql restart : restart mysql service
To connect mysql server from mysql built in client, use the below command
$> mysql -u root -p
If your root password is empty, just press enter again. You will be prompted to
mysql >
First of all here you are not starting mysql. And this error is coming directly from mysql ubuntu has nothing in this. Your error says that mysql is already started but the the current user by which you have logged in Ubuntu is not found in the mysql's user table.
Typeing simple mysql means you want to log into mysql with current OS user that is sasa in your case.
try : mysql -uroot
Here root means mysql's root user not OS' root.

can't connect to mysql server

I have a problem installing mysql 5.5.20 on my ubuntu 11.10. after "ps -e | grep mysql" I found mysqld_safe and mysqld is running, but it is not right when I try to connect to the server, the error is like this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I have check the /etc/my.cnf which locate the mysql.sock in /var/lib/mysql/mysql.sock, and the access right of that folder is:
drwxrwxr-x 2 mysql mysql 4096 2012-01-17 01:54 mysql
after "find mysql.sock" I found it in /var/run/mysql, it is really confusing
any help will be appreciated, many thanks~
Often that error message can mean something wrong at an application level, rather than with MySQL.
Open Terminal and attempt to connect to MySQL.
mysql -u root -p
Press Enter, then enter your password and hit Enter again. Once you’re in, use SHOW DATABASES to find out what databases are available and if the one you’re trying to connect to is there.