Problems with mysql config - want to understand - mysql

i know that there are many questions which are connected with my question, but nothing helps me to come to my goal.
I'm on mac osx 10.10.4
in the past i had MAMMP installed on my mac. Later i deleted it to configure my local hosts by my own. In the meantime i use vagrant for this. But i want to understand how the local mysql config works.
My problem:
If i type "mysql -uroot" i get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
The /Applications/MAMMP/.. folder are deleted and not there. So i think there must be a config file where this is inserted. But i cant find this file. Not in /etc/my.cnf and not in /usr/local/mysql/support-files/... nowhere...
Could anyone give me hints where my config for that is destroyed and how i can reapair it?
Would be great to hear from you guys. Thanks

Related

Missing mysql.sock while connecting mysql in Centos

I'm trying to connect to mysql in Centos. I was using this normally. But this morning i wasn't able to connect. Looked through various links on internet and got to know i'm missing mysql.sock. I looked through find command but all in vain.
Error:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Not exactly answer. But reverted back to previous state using snapshot. And problem got solved.

Local wordpress issues: Mac MAMP

I'm having some issues with my local environment. I had setup a wordpress site locally on my Mac through MAMP. All was working well until my computer powered down (not plugged into power source). Now there appears to be issues with the database. When i run MAMP and try to connect I get the error "Error establishing Database Connection". Also when i go through the MAMP portal at localhost and click on Tools > PHPMyAdmin I get the following error:
MySQL said: Documentation
#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).
mysqli_real_connect(): (HY000/2002): No such file or directory
Obviously something has gone very wrong with the database connection but do not know how to resolve. I have tried to run some scripts in terminal to stop mysql process to no avail so far.
Any advise appreciated. I have looked at some similar but not exact other posts and does not seem to resolve.
Note: The ports changed at some point in the process, but everything else seems fine related to the new port setup but this may be relevant
thanks
While, I'm not sure of the cause. FINALLY found a solution to this very frustrating issue.
What ended up working for me is to uninstall the new version 4.2.1
I did this through first going to the MAMP PRO folder and using the MAMP Pro uninstaller and then moving the Mamp and Mamp pro folder to the trash.
I then went and found the old version to install
https://www.mamp.info/en/downloads/older-versions/
When I downloaded 3.5.2 whatever issues it was having with local databases were resolved. Go figure! Glad to finally have resolved not sure why this would happen other than perhaps a bug in the new version.
Thanks to those who pointed out some possible things to look at
I'm running MAMP 4.0.6 and getting the same error on local wordpress installations, and same error message as described when trying to go to phpmyadmin on MAMP.
The reason seemed to be that the mysql server does not start. The solution that worked for me is offered in this reply in another thread:
https://stackoverflow.com/a/45582509/4623519
Quit MAMP. In the finder go to Applications/MAMP/db/mysql/. Delete the last log file (look for a file named ib_logfileN – being N the log number Eg-ib_logfile0 and ib_logfile1) Nice screenshot provided in link above.
This seems to be happening often according to this post from 2013.

XAMPP, MAMP, MySQL errors

I'm facing a lot of errors at the moment ranging from "No such file or directory" to "Error 403 - Access to the requested directory is only available from the local network." along with a series of permission obstacles relating to mysql.
Admittedly I was playing around with mysql, XAMPP and MAMP today (I'm new to back-end programming) and think I've screwed something up somewhere that's preventing them from working correctly.
Specifically, I'm using XAMPP now and while the status is fine (green) and connected to my IP address, along with MySQL, Apache and ProFTPD services all being connected, I can't find any of the related XAMPP files needed to resolve Error 403. Eg.
Bryans-MacBook-Pro:~ bryanjordan$ chmod -R 777 /Applications/XAMPP/xamppfiles/var
chmod: /Applications/XAMPP/xamppfiles/var: No such file or directory
When I open XAMPP, right-click and all in the Applications directory, all I see is a Contents folder with no reference to xamppfiles.
To clarify, I downloaded XAMPP, imported into Applications, opened, connected to servers and once re-directed in my browser, clicked phpMyAdmin but reached the 403 Error.
I've also linked MAMP and don't have this issue. I can access phpMyAdmin fine through this process.
I should also note, that even though I have MAMP operating fine, I can't access mysql via the command line even when I use the path directory instead of a simple, mysql -u root -p call. Instead I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I'm unsure if this is related but before downloading MAMP or XAMPP I was able to type "localhost/~bryanjordan" into the browser and I'd be redirected to my Sites directory. When I type the same URL in now, I receive this error:
The requested URL /~bryanjordan/ was not found on this server.
Thanks for the help!
Setting up xampp or mamp should be simple to setup. Here is a link to a handy tutorial: https://www.webucator.com/how-to/how-install-start-test-xampp-on-mac-osx.cfm
For XAMPP if it cannot find the folder make sure its actually in your applications folder and make sure your system has permissions to read and write to it.
For MAMP or even XAMPP, if you cannot start your mysql it might be permissions. Please see the link above for the relevant command to run on the command line.
Also given the amount of errors you are having i would recommend removing both and starting from scratch with just one of them using my link above.
Hope this helps!

setting up MySQL Workbench with MAMP - missing 'mysql.sock' file

I am having trouble connecting MySQL Workbench to MAMP. I am using version MySQL Workbench version 6.0 and MAMP version 3.0.3.
I have followed the instructions on this link: http://www.rubberneckdesigns.com/mamp/how-to-set-up-mysql-workbench-for-a-mamp-server/comment-page-1/#comment-6539 (this is just basic instructions to setting up MySQL Workbench with MAMP so no need to look through if you are familiar with the set up steps)
It all goes okay until the step were I have to select the Configuration File as:
/Applications/MAMP/tmp/mysql/mysql.sock
This file does not appear to be in this location or anywhere else on my computer.
In the answer to this link: Database connection "Mysql" is missing and mysql.sock is missing, he says he managed to figure out that his mysql.sock file was actually hidden, however I have my Mac set to display hidden files and I can see all my other hidden files, but still no sign of this file. He said after finding it was hidden he went to his database configuration file and added the following:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
Does anyone know what file he is referring to when he says database configuration file? I have tried figuring it out using Google but no luck. I am new to MAMP and new to MySQL Workbench.
This problem with the mysql.sock file, seems to be a problem for a lot of people. If anyone has a better solution than adding the above command to the database configuration file or can shed some light on this problem I would love to hear it.
Thanks
I have not been able to figure out where the mysql.sock file is, Mike Lischke has left a comment saying the socket file is created dynamically when you open a connection, which could be the case, but I do not know much about MySQL and the files so I can not confirm if this is correct, however, I have found the solution to my problem.
The overall problem was that I could not connect MySQLWorkbench to my Local Server (MAMP) as I could not find the mysql.sock file. When I tried to connect I was getting an error message saying it could not find the mysql.sock file.
The solution to my problem was to instead of setting the 'Hostname' in the MySQLWorkbench set up window as 'localhost', which is suggested in the guide I followed, I instead set it to the IP '127.0.0.1'. I then set the 'Connection Method' to 'Standard (TCP/IP)' instead of 'Local Socket/Pipe'. I believe what this is doing is setting it up to connect through the IP rather than the Socket, meaning the mysql.sock file is no long necessary.
This is a very simple solution and in hindsight it makes sense and I probably should have known this from the start, however because I am new to MySQL I didn't. If anyone else is having a similar problem connecting, I hope this helps.

mysql-connect error beginner

I finished a web page in my computer and it was saved in my pen drive. Now I uploaded the files .html and .php to the server, and I exported the database of my pen drive and imported it on the web address using phpmyadmin. Seems like I'm having the following problem:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/t1g01/doador.php on line 40
The files in my pen drive are working fine. But not in the server. Can anyone help me please? When I explore the tables in the http://address.com/phpmyadmin/ there are normal, with data.
I read something in another topic about restarting the mysql by typing /etc/init.d/mysql restart or ln -s /var/lib/mysql/mysql.sock /tmp/ . If that's solve my problem, where am I supposed to type this ? I'm new at this server stuff.
Sorry for any mistake in English, and thanks in advance for the attention.
MySQL has a page for common errors and troubleshooting help:
http://dev.mysql.com/doc/refman/5.1/en/common-errors.html
I also contributed a wiki page about connection troubleshooting:
http://forge.mysql.com/wiki/Error2003-CantConnectToMySQLServer
You should also check whether your MySQL instance is using /tmp/mysql.sock or some other location for the mysql.sock file. It's not uncommon for PHP and MySQL to have different ideas about where that file lives.
So check php.ini and mysql.cnf on your server.