Yosemite - MAMP - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) - macos

I have problem when I try to connect to MySQL MAMP :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I'm doing research but I have not found a solution to my problem, I try to link mysql.sock like this :
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
But, the file /tmp/mysql.sock doesn't exist.
Do you have any ideas ? The problem is blocking me for 2 days, I searched for this time but nothing good for me.
Thanks in advance,

I had the same problem after upgrading MySQL on MAMP from 5.5 to 5.6 version.
After long research I founded this decision https://drupal.stackexchange.com/questions/32402/drush-and-mysql-database-with-mamp-connection-problem
In my case there was no socket file at that location /Applications/MAMP/tmp/mysql/mysql.sock.
The easy solution is to create a symlink:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock ./mysql.sock
The effect of which is to route all calls for /tmp/mysql.sock to the appropriate MAMP specific path.

simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56

In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)

I had the same problem. I solved it following these steps:
I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
I entered sudo mysql_upgrade in a terminal window, and pressed enter
After the update process I was able to connect with my MySQL.

Rename .sock file of mysql and restart your MySQL server.
/Applications/MAMP/tmp/mysql/mysql.sock to /Applications/MAMP/tmp/mysql/mysql_old.sock

Also check to make sure MySql is running. You can get this error if you try to use MySql from the command line when MAMP/MySql is not running.

In case this helps anyone, I got past this roadblock by:
Stopping all other versions of MySQL (I forgot that I had Oracle MySQL starting on system launch and I was attempting to connect via that installation.) and removing them anyway to let MAMP handle it.
Use sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Ensure MAMP is running.
Running /Applications/MAMP/Library/bin/mysql.

1) mysql.server stop
2) /Applications/MAMP/bin/startMysql.sh &&
now on MAMP go to
Tools => Upgrade MySQL databases

Related

MAMP no longer prompt for a password and Apache won't start

After an upgrade to MAMP 6.7 on macOS Monterey, MAMP no longer prompts for a password and Apache won't start.
At MAMP start:
MySQL starts
Apache doesn't start
I must execute /Applications/MAMP/bin/startApache.sh in Terminal to start Apache
At MAMP stop:
I must use /Applications/MAMP/bin/stop.sh
Until this update (to 6.7), MAMP asked me for a password every time I started.
I tried several solutions found here. Same problem with port 80 or 8888. At each test, I kill all HTTPD or MYSQLD process. Renaming or deleting envvars does nothing.
It seems that MAMP can't execute startApache.sh.
Edit :
The last update 6.8 solve this issue : https://www.mamp.info/en/release-notes/mac/#v6.8
It seems that MAMP found something about this issue : https://www.mamp.info/en/release-notes/mac/#v6.8

Postgresql can't connect application server through PGAdmin4

I installed PostgreSql on my Windows machine.
I can connect to PostgreSql through cmd.
But when I want to launch pgAdmin I am getting this error message.
Failed to connect to the pgAdmin application server. Click here to try again.
I have also Mysql installed on my machine if it can make any complications.
The same problem happened to me today:
And this is how I've solved it:
1) Use a text editor to open the config_distro.py file under the c:\Program Files\pgAdmin 4\v1\web folder. Change the value for SERVER_MODE from True to False, then save the change. (I have run Notepad++ as an Administrator, in order to be able to save in this protected folder.)
2) Go to folder c:\Users\your_name\AppData\Roaming\pgAdmin and make sure there is nothing there (delete all the files, as they are temporary and will be restored after starting pgAdmin)
3) Start pgAdmin
4) This time you will see a white box that sits - at least, on my slow laptop - about 20 seconds. (You may briefly see the original error message, but do not worry).
5) Meanwhile, the temporary files - required for running the application - are created.
6) Once the temporary files process is over, the application starts as expected.
Try starting the pgAdmin as administrator.
My config_distro.py was missing this line:
MINIFY_HTML=False
I added it as in the above steps and it works
In my case, SERVER_MODE was already False in config_distro.py. I then proceeded to start pgadmin4 as an administrator. This also did not work. Finally, I resolved this by restarting postgresql service in services.msc.
postgres service restart
In my case, the problem was non-ascii username.
Find pgAdmin installation and open/create config_local.py in editor, add this:
DATA_DIR = "C:/Data/pgAdmin" # set non-ascii path here
and run setup.py using python interpreter.
You can start the server manually - any errors will echo on the terminal. The windows app seems touchy on timing - this allows the server to take as much time as needed to start up.
Assuming you installed version 3 into "p:\pgAdmin 4" run the following commands"
p:
cd "\pgAdmin 4\v3\web"
set PYTHONPATH=P:\pgAdmin 4\v3\venv\Lib;P:\pgAdmin 4\v3\venv\DLLs
python pgAdmin4.py
When I run that I get the following output:
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
I ran into this today even though the service was running in Windows 10. I just stopped the service, gave it a few seconds, and restarted it. I was able to connect with pgAdmin 4.
In my case the problem was solved by restarting the postgresql service.
Windows-> Service -> find for postgreSQL -> Stop and then Start

Why won't Apache Server start in MAMP?

I'm trying to view php files locally on my mac.
I'm running Yosemite.
I have MAMP installed on my computer. When I press start the MySQL server starts but Apache doesn't. An error message appears saying 'Error. Apache couldn't be started. Please check your MAMP installation'
I've gone through the internet typing stuff into terminal and changing 'envvars' to '_envvars' but nothing works.
I reinstalled OSX and that worked but when I shut down the computer the problem occurs again.
Can anyone help?
Thanks
Check if you changed the Document Root Location or Renamed it. At least this was my mistake.
MAMP > Preferences > Web Server > Document Root
I didn't get it working with port 8000 or the default 8888, but did get it working with port 80 per the suggestion here:
http://forums.macrumors.com/showthread.php?t=1744944
That didn't work after all, but it didn't error out. However I manually ran the following at the command line (because log file was empty):
sudo /Applications/MAMP/Library/bin/apachectl start
Only to find that after upgrading I was missing the mod_example.so
httpd: Syntax error on line 83 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_example.so into server: dlopen(/Applications/MAMP/Library/modules/mod_example.so, 10): image not found
Copied it from my old install and I was good to go.
If you try to start the server from the terminal, likely that will tell you what is wrong e.g.
sudo /Applications/MAMP/bin/startApache.sh
Password:
(48) Address already in use: make_sock: could not bind to address [::]:8888
(48) Address already in use: make_sock: could not bind to address 0.0.0.0:8888
no listening sockets available, shutting down
Unable to open logs
What you can do in this case, I was inadvertently running a Blockstack browser out of 8888, so changing MAMP to 8887 allowed it to start. [Your mistake might be different.]
Had the same problem, nothing in the logs. After trying the_dillio's suggestion:
sudo /Applications/MAMP/Library/bin/apachectl start
I got an error that pointed back to my vhosts file. It turns out I had an extra /VirtualHost tag. Removed it and it started working again.
i've solved this issue using this command in the terminal :
sudo apachectl stop
I think I've found the solution.
It was the wrong port. I altered the .conf file in the Apache folder. I changed all instances of port 8888 to 8000. When I run MAMP now it all seems to work fine.
Thanks for your help
Also be aware that if you by any chance deleted the folder that was set as Document Root the last time you were using MAMP, you will get this error. Simply open MAMP again, change Document Root to a location that does exist and start the servers.
I received the same error but interestingly it was caused simply because I renamed the root folder and didn't realize it. Sounds like you have a different issue but for anyone else who gets this error message, make sure you haven't renamed the root!
Absolutely bizarre behavior for MAMP PRO (paid license too btw...)
In my case I had to change the location of the log file in order to get it to work...
Click on Mysql icon then the little folder to the right of the path and try changing it to something else.
For MAMP :
You can open the terminal and write:
ps aux | grep mysql
lsof -i
killall -9 mysqld
I hope is good for you!
Bye
I had this experience when upgrading to V4. It tried to used the files from my previous installation and it just never worked. The workaround was to RENAME the original MAMP installation to something different than "MAMP", install brand new version and then copy files you may need like VHOST configs and DATABASES. After all this it worked just fine.
My Apache server problem arose after I enabled SSL. So if this is your case, check your https-ssl.conf file (Applications -> Mamp -> conf -> apache -> extra). The Document Root under the Virtual Host settings had a different file path for htdocs than where it was actually located (easily overlooked). I changed this to "/Applications/MAMP/htdocs" and problem solved. Perhaps also check Document Root in your https.conf file (Applications -> Mamp -> conf -> apache) to see if it has the correct file path to htdocs too.
These are the steps I used to solve this issue.
Checking vcredist that are required and installing them. to check which are the missing vcredist I used a tool called "check_vcredist" from wamp.
I also installed latest Microsoft Visual C++ Redistributable x64.
Doing this steps solved my issue of Apache server not running

Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061

Here is my mongod.cfg file:
bind_ip = 127.0.0.1
dbpath = C:\mongodb\data\db
logpath = C:\mongodb\log\mongo-server.log
verbose=v
Here is my mongod service command:
mongod -f c:\mongodb\mongod.cfg --install
I have installed MongoDB about a week ago and it all worked fine, however today when I ran mongo command I got the following error:
Failed to connect to 127.0.0.1:27017,
reason: errno:10061 No connection could be made because the target machine actively refused it
How can I fix that? I use Windows 8.1
Solution:
I forgot to start mongodb service with this command:
net start mongodb
Improved solution:
1) Change directory to root drive C:\, and type the command below into an admin cmd prompt window,
C:\mongodb\bin\mongod.exe --config c:\mongodb\mongod.cfg --install
2) Then type net start MongoDB after which you should see the following message:
"The Mongo DB service was started successfully"
3) Then go to the control panel Start>Administrative Tools>Services, scroll down to MongoDB in the list of services and change start up type to automatic, if you so desire. Press OK.
4) Finally type C:\mongodb\bin\mongo.exe and you should be connected to the Mongo test DB.
Reference: https://www.youtube.com/watch?v=-mik4dPArCU
This is how I solved it, You can follow step by step here:
MongoDB Steps:
Download the latest 64-bit MSI version of MongoDB for Windows.
Run the installer (.msi file)
Add it to your PATH of environment variables. it Should be from:
C:\Program Files\MongoDB\Server\3.0\bin
now Create a “\data\db” folder in C:/ which is used by mongodb to store all data. You should have this folder:
C:\data\db
Note: This is the default directory location expected by mongoDB,
don’t create anywhere else
.
Finally, open command prompt and type:
>> mongod
You should see it asking for permissions (allow it) and then listen to a port.
After that is done, open another command prompt, leaving the previous one running the server.
Type in the new command prompt
>> mongo
You should see it display the version and connect to a test database.
This proves successful install!=)
Reference link
When you typed in the mongod command, did you also give it a path? This is usually the issue. You don't have to bother with the conf file. simply type
mongod --dbpath="put your path to where you want it to save the working area for your database here!! without these silly quotations marks I may also add!"
example: mongod --dbpath=C:/Users/kyles2/Desktop/DEV/mongodb/data
That is my path and don't forget if on windows to flip the slashes forward if you copied it from the or it won't work!
I was also faced the same issue with mongodb 2.6.
What solved my problem was I just run mongod --repair command
and then start mongod.exe
It's worked for me
just create a folder
C:\data\db
Run below commands in command prompt
C:\Program Files\MongoDB\Server\3.4\bin>mongod
Open another command prompt
C:\Program Files\MongoDB\Server\3.4\bin>mongo
mongodb 2.6.8 on windows7 32bits
you only need create a folder c:/data/db
execute mongod, and execute mongo
Point to your mongodb instalation e.g C:\Program Files\MongoDB\Serve\bin and run mongod.exe so you can open connection to 127.0.0.1:27017.
If it writes that you had not properly shut down or that mongod.lock is not empty
, only delete mongod.lock from C:\data\db\ and it will start.
The problem is that I missed out 'db' folder for the dbpath in the command:
C:\mongodb\bin> mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongodb.log --logappend -rest --install
Under normal conditions, at least 3379 MB of disk space is needed. If you do not have that much space, to lower this requirement;
mongod.exe --smallfiles
This is not the only requirement. But this may be your problem.
What solved my issue was creating a file startmongo.conf that sets the bind_ip to 127.0.0.1 . After that, I just created a *.bat to start the mongo using something like:
mongod --config c:\mongodb\bin\startmongo.conf
When This Error is Coming it is lack of the following
1)Setting the path to mongo db
go to "C" Drive and the installation of Mongo db directory and then go to bin folder in the mongo and copy the path of it
c:/mongodb/server/3.2/bin/ and create a new environmental variable in system properties then name is path and value="c:/mongodb/server/3.2/bin/" here my version is 3.2
2)create a data directory for the data in C Drive
c:/Data/twitter
3)start the server with **
c:/> mongod
check your port config if there is any error as the local port may be assigned to any other
4)start your Mongo database with
Mongo
then your mongo db will start
then in your mongo database
create a database
use DATABASE_NAME
for example:
use twitterdata
switched to db twitterdata
to check your current database
db
twitterdata
to get total databases
show dbs
I started mongod in cmd,It threw error like C:\data\db\ not found.
Created folder then typed mongod
opened another cmd typed mongo it worked.
Here are the steps to solve this issue:
Just go to your MongoDB bin folder and run the mongod.exe file.
Navigate to your mongodb bin folder via Command prompt and start mongo by typing "mongo"
Change file permission to 755 for the file:
/var/lib/mongodb/mongod.lock
first you run the command mongod and check weather the port 27017 has started or not if yes then hit the command mongo....and database will start.
The Port is not open. Thats why the machine refuses communication
Try this, it worked for me.
mongod --storageEngine=mmpav1

XAMPP on windows 7 not working properly

I just installed XAMPP lite on Windows 7. I have two drives - C: for the OS and regular files, and an external drive E:. I installed XAMPP lite on E: (on the root), and its been giving me problems. Apache works well enough, but MySQL doesn't work. When I go to http://localhost/phpmyadmin/, it gives me the following error:
Error
MySQL said:
#2003 - Can't connect to MySQL server on 'localhost' (10061)
Connection for controluser as defined in your configuration failed.
Any ideas as to what could be the problem? I used the zip file for XAMPP lite, the 32 bit version. This is on Windows 7 Home premium.
Thanks!
This happened to me today, and it was because Dropbox.exe was using port 3306. If you run the Port-Check from XAMPP control panel, you will be able to see if there are any conflicting port issues.
You need to actually start the MySQL database server.
Start the XAMPP Control Panel and click the "Start" button just to the right of where it says MySQL.
(Or run the "mysql_start" batch file)
Please edit your config.inc.php file in phpmyadmin subfolder inside xampp's installation, and specify '127.0.0.1' (instead of any other value like 'localhost) for the $cfg['Servers'][$i]['host'] setting as follows:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Then try with:
http://127.0.0.1/phpmyadmin
and it should work (at least it worked for me and I had exactly the same problem).
If this doesn't work you can try solutions described here:
http://forums.mysql.com/read.php?35,64808,254785#msg-254785
OR:
you can leava the setting mentioned above as:
$cfg['Servers'][$i]['host'] = 'localhost';
and edit %windir%\system32\drivers\etc\hosts adding the line (if it doesn't already exist):
127.0.0.1 localhost
Please note: I am using xampp beta which you can find here: http://www.apachefriends.org/en/xampp-beta.html
EDIT:
Recently I have found this link http://www.ihostnz.com/howto-install-xampp-windows-7-xdebug-netbeans, followed the instructions there and now everything works like a breeze.
Sometimes I get this error:
ERROR: MySql service not started [-1]
when installing XAMPP on developers' machines (Windows-based), because often developers already have a MySql installation on their computers. MySql installs itself as service with the default name "MySql"; XAMPP uses this name too for his own MySql, it gets confused. So, my solution is:
remove existing "MySql" service, the one created by the MySql installer;
re-add it with a new name (not "MySql")
use XAMPP happily :)
Here is a more general article (in italian language, but you should figure it out):
XAMPP: cosa fare quando qualche servizio non parte (Windows)
just go to the xampp folder then phpmyadmin folder. here u will see a user_password.php file. just make the password null

Resources