So only when I go to my local PhpMyAdmin window, I get the #2002 message.
I searched the net and I found a terminal command to check if Mysql would be running in the first place and it does.
Running /Applications/MAMP/Library/bin/mysql -u root -p
gives me
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.9 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
That doesn't look bad I think so the error must not have much to do with that.
I read that there's the config.inc.php file where you replace the value 'localhost' with '127.0.0.1' but that didn't change the situation.
Then I went looking in MYSQL forums it is suggested to check the my.cnf file to check for certain values. but I can't find it anywhere. Is there another file that has the same function in MAMP?
Since the top-voted answer was hosted on Posterous, which no longer exists, this is a bit of an orphan. The content is archived at Archive.org but just in case that goes away, too, the linked answer was:
Today, I tried to install Mysql on OS X Lion using SQL Packager. I faced a very common issue:
MySQL Forums :: Install :: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Turns out you can regenerate this file in the terminal with this:
ps -e|grep mysqld
sudo mysqld_safe
Thanks David Bocage for the tip.
Alright,
I finally got my PHPmyadmin page loaded again without getting the #2002 error. What I did is I kept reviewing the settings for the mysql socket file until at a certain point my phpmyadmin did show up the way it should. So I'm still not really sure why it happened.
I also noticed there was a portnumber mismatch between the actual port setting in MAMP (8888) and a certain php file I cant remember (where it was 3306) which set to match again. Can't be certain that this is what made it work though.
I had the same problem. Easy fix:
Go to /Application/MAMP/bin/phpMyAdmin/ and open up config.inc.php
on line 71 you see $cfg['Servers'][$i]['port']
For some reason the default ports got switched on my machine, so I set it to 8889. Save and phpmyadmin is back up and working!
Wooo
Related
I run mysql.server stop
then
$ mysql.server stop
Shutting down MySQL
.. SUCCESS!
And mysql configuration is like this. It seems to be stopped.
However, I can run mysql -uroot
$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15 Homebrew
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
What is happening ?
I guess that two mysql are installed because I used homebrew to install mysql. If so, how to stop another one ?
if you want to make sure, you could always ps the MySQL process.
Also, you could check if the port to see if it's been occupied by the MySQL process.
I found the reason. I once run brew services start mysql.
So, even if i run mysql.server stop, soon mysql server restarted.
I disabled auto restart by brew services stop mysql
I'm quite stuck, I installed the new version of mysql (8.0.12) with homebrew.
Then I dumped my databases from mysql (I was using the MAMP stack and did that to get rid of it...).
However when importing the dump the databases were created, everything seemed to be in order. then I tried to connect my IDE (phpstorm) to it, and I got an error saying "Unable to load authentication plugin 'caching_sha2_password'." (I think this was introduced with this new version...).
I created a my.cnf file and put:
[mysqld]
default_authentication_plugin=mysql_native_password
Still did have the same issue...
So I also tried creating a user with a password to be under this new algorithm (caching_sha2_password). Did not work as well, I logged in as sudo to mysql and it gave me the below:
MacBookAir$ sudo mysql
Password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.12 Homebrew
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1726 (HY000): Storage engine 'MyISAM' does not support system tables. [mysql.db]
Last but not least, I changed the configuration in my.cnf file using this below:
default_authentication_plugin=mysql_native_password
Any idea guys?
Cheers
MyISAM is based on the older (and no longer available) ISAM storage
engine
... See https://dev.mysql.com/doc/refman/8.0/en/myisam-storage-engine.html
There are several checks you can run ON your MySQL 5.* installation to see if you can upgrade ( these are just examples):
mysqlcheck -u root -p --all-databases --check-upgrade
mysql_upgrade --user=root -p --host=localhost —force
If you have the mysql shell:
mysqlsh -- util checkForServerUpgrade root#localhost:3306 --target-version=8.0.16 --config-path=/etc/my.cnf
Those commands may fix, upgrade or repair problems with your database.
On your 5.* installation, I recommend you convert your MyISAM tables to InnoDB and use the new default character set utf8mb4 which has wider support for more character sets.
ALTER TABLE table_name ENGINE=InnoDB;
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4;
Use mysqldump to save your schema.
Install MySQL 8 separately. (don't upgrade your 5.* installation to 8.)
Import your mysqldump file into your mysql 8 installation under the new database you created.
Create user accounts:
The user accounts must be created using the old authentication plugin - it's the only way PHP can connect. Also, you must be using PHP 7.2.4 or higher.
CREATE USER 'user_name'#'localhost' IDENTIFIED WITH mysql_native_password BY 'my_password';
Grant your user access to the appropriate schema. Something like:
GRANT ALL PRIVILEGES ON *.* TO 'user_name'#'localhost';
NOTE:
PHP's mysql native driver ( mysqlnd ) has not been updated to use the new default authentication plugin (caching_sha2_password)
Tell mysql to use the old authentication plugin when creating user accounts by adding this to your /etc/my.cnf file:
default_authentication_plugin=mysql_native_password
But if you don't include the above directive in your my.cnf file, you can still issue the create user statement with the "IDENTIFIED WITH mysql_native_password" clause to use the old auth plugin!
So I decided to remove mysql 8, and install 5.7 which then works fine for me and obviously no compatibility issues.
This is a quick and dirty alternative to the compatibility issue between mysql server 5.* and 8.0.
The issue was that I migrated my databases from mysql v 5.* (MAMP stack) to mysql server 8.0 (installed separately), therefore the dump was creating some of the system tables with MyIsam engine (as it seems that in prior version, I think Innodb couldn't be used for system tables...?).
However, this was causing me a lots of issues in altering any system tables (user password etc...), I'm not sure whether it is because they are trying to get rid of the MyIsam engine and so new plugins are not adapted such as caching_sha2_password (and btw changing my.cnf file and adding "default_authentication_plugin=mysql_native_password" did not work for me...)
Thanks
So I have just installed linux and started messing around with apache,php,mysql and I have this error when creating database. I was unable to find an answer so i hope you guys can help me.
max#MaxLNX:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database firstdb;
ERROR 1006 (HY000): Can't create database 'firstdb' (errno: 13)
Error means that your mysql server doesn't have enough space.
Check the file system size, and remove unwanted software(s),or files.
There may be a permissions issue with the MySQL data directory. You could try setting the permissions as follows (adjust the path to your data directory)
chown -R mysql:mysql /usr/local/mysql/data
reply if it worked
Try using "sudo". On a Linux system, "sudo" means "superuser" and should help you gain access to make a database. Try this in your terminal:
sudo mysql -u root -p
i have install mysql for a mont ago. i use every day without any problem. and now, my mysql very strange. i can login to mysql, and alway succees. but, sometime cannot run a query.
this is the sample of unseccessfull query:
gai#gai-Lenovo-G470 ~ $ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use sps;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show databases;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
ERROR:
Can't connect to the server
mysql>
I am very confused. how to solve this problem?
This is a common issue, The largest cause is usually just timeout issues, Do you get this error after a large amount of idle time?
If the command returns a large amount of data that is to large it can also cause the issue.
The various causes and fixes are listed HERE Please try the fixes and if you still have issues let us know what you have tried.
I'm having a really annoying problem to connect to MySQL by Git Bash 2.5 (via Windows on localhost).
Everything works fine trough CMD and Mysysgit.
$ mysql -u root -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
But, look at this. Git SCM for windows still stuck, blinking the cursor for ever and ever. Have you guys seen this? Anyone can help me?
$ mysql -u root -proot
Warning: Using a password on the command line interface can be insecure.
Thanks in advance.
the solution is provided here:
Git Bash mysql blank
use this winpty before any window command and it works.
winpty mysql -u root -proot
The issue 242 point out:
this is a known problem (see git-for-windows/build-extra/installer):
Some console programs interact correctly with MinTTY only when called through winpty (e.g. the Python console needs to be started as winpty python instead of just python).
If you do not like that, feel free to choose the installer option not to use MinTTY.
Please note also that Git for Windows is not your "Linux on Windows". It really is supporting Git on Windows and not necessarily mysql.
Using mysql in a docker container (like nkratzke/EasyMySQL) would be easier and provide a more manageable Linux environment.