Getting mysqlnd error when using Snow Leopard's Apache - mysql

After installing Snow Leopard I got the following error when connecting to a remote MySQL server:
mysqlnd cannot connect to MySQL 4.1+ using old authentication
What I don't get is why it's working fine with MAMP when I only start MAMP's Apache, but I get this error with Snow Leopard's build in Apache. Is it because MAMP has some MySQL files locally? Do I still need to install MySQL locally when I try to connect to a remote server? Any clue as to how to fix this on my side without messing around with the server? Preferably Apache only — don't want to install anything I don't need.
Edit: solution
Turned out PHP wasn't loading any php.ini file. A sudo cp /etc/php.ini.default /etc/php.ini did the trick. First it was only loading php-mysqlnd, now php-mysql as well, and all is fine.
Hmm, I was wrong, this doesn't solve anything.

Any luck with this? I'm having the same exact issue. I tried resetting the password using both pre 4.1 and post 4.1 authentication with no avail.
EDIT::
My mysql server had the use old passwords option set in the configuration file, so the result of PASSWORD() and OLD_PASSWORD() returned the same 16 digit hash.
I ran SELECT PASSWORD('mysecret') on a different mysql server that uses new passwords to get the hash, then ran SET PASSWORD FOR 'myuser'#'%' = '*THEHASHFROMTHESELECTSTATEMENT';.
hth

Try re-setting your user-pw on the MySQL-Server.
This way the password should be stored in the new format.
However, your mysql-library shipped with Snow Leopard might be compiled without support for old passwords.
Even on a live-server it should be okay to create a new db-user, so can check with a new user-account if you don't want to change the existing one.
What I don't get is why it's working
fine with MAMP when I only start
MAMP's Apache, but I get this error
with Snow Leopard's build in Apache.
Is it because MAMP has some MySQL
files locally? Do I still need to
install MySQL locally when I try to
connect to a remote server? Any clue
as to how to fix this on my side
without messing around with the
server? Preferably Apache only — don't
want to install anything I don't need.
MAMP has all the files stored on his own, in his own versions.
You don't have to run a local MySQL-Server if you want to connect to a remote server. You just have to install the mysql-libraries for PHP.

you can do these line on your mysql query browser or something
SET old_passwords = 0;
UPDATE mysql.user SET Password = PASSWORD('testpass') WHERE User = 'testuser' limit 1;
SELECT LENGTH(Password) FROM mysql.user WHERE User = 'testuser';
FLUSH PRIVILEGES;
note:your username and password
after that it should able to work. I just solved mine too

Related

Xampp connects to MariaDB instead of mysql (KNP/SymfonyCasts tutorial "how to speak database")

I am following tutorial from KNP/SymfonyCasts and I have problem with connecting to mysql.
That's what tutor write in her terminal
And that is my output
I assume this matter so... How can I change this? They do not cover issue, just mention that if blank password doesn't work, I should use "root".
MariaDB comes with XAMPP.
Since you installed XAMPP and are using it, obviously it will connect to its MariaDB installation. MariaDB is Mysql.
Don't install the MySQL that comes bundled with XAMPP or just change the config and point it to your other MySQL installation if you have one (a community server, for example)
Or just use the MariaDB(Mysql) from XAMPP.

Linking MAMP on Mac to a different instance of MySQL and phpMyAdmin

I am using macOS Sierra 10.12.2, MAMP 3.0.7.3.
I have been using MAMP with the MySQL it comes with for a while but I need to run something (Magento 2) that requires a higher version of MySQL than the version MAMP comes with, and I don't want to upgrade that instance of MySQL that comes with MAMP. So I am trying to install a different instance of MySQL for use on this project. I still want to use MAMP's Apache server with PHP to run the project though. I also still want to be able to switch back to the other instance of MySQL.
I am essentially trying to follow this tutorial, but I also want to install phpMyAdmin: http://www.human-element.com/installing-magento2-on-mac-for-local-development/
I have installed MySQL 5.6.35 to /usr/local/mysql/bin
The MAMP MySQL is at /Applications/MAMP/Library/bin/mysql
/Applications/MAMP/Library/bin/mysql --version is 5.5.38
mysql --version is 5.6.35
It seems to be installed correctly but I want to use phpMyAdmin for it, which is where I am having trouble. I downloaded phpMyAdmin 4.6.6 and installed it to /Applications/MAMP/htdocs/phpMyAdmin-4.6.6 (as I still need MAMP to run it). But it seems to be linking with the MAMP instance of MySQL and not the new instance of MySQL. I can only log in with credentials for the MAMP MySQL users and I see all my MAMP databases.
If I go to localhost/phpMyAdmin-4.6.6/setup I think the setup must be wrong but I'm not sure how to specify the other MySQL instance:
I tried changing the server socket path to /tmp/mysql.sock too - this had no noticeable effect.
I also have some symbolic links set up, although I admit I don't really understand what this is for...
cd /var/mysql/
# This one was set up before when I was just using MAMP:
mysql.sock -> /Applications/MAMP/tmp/mysql/mysql.sock
# This is the equivalent I set up (removing above one) for the new instance, but not sure if correct:
mysql.sock -> /tmp/mysql.sock
I've tried switching between both but it doesn't seem to have any effect on phpMyAdmin.
Can someone explain how I link the new version of phpMyAdmin with the new instance of MySQL?
Since you're essentially trying to run two MySQL instances at the same time, you have to make sure they're not using the same socket and TCP/IP port. These things are configured in the MySQL configuration file. I suggest not messing with the MAMP installed version, so edit the one you installed and make sure the port and socket path are different. Also make sure your data directory is different; you can't use the same datadir for two MySQL instances at the same time, and certainly not changing between versions, either. Once you have that sorted out, you can configure phpMyAdmin to connect to them both (you can define more than one server, based on port, hostname, and/or socket).

Should I reinstall Mysql?

I'm getting kind of desperate here trying to get mysql to work on osx lion.
I've been through nearly every article on the web these past few days looking for a way to fix the problem with the error.
When I try to start the server is gives this error:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
when I try to create a database with 'rake db:create' it gives the same error.
sometimes it says that or I get errors about "please install gem-blabhalbhabhlb". And that gem doesn't exist.
I was able to install mysql in terminal using the dmg version from mysql's site but after I deleted the installation files it just stopped working- as in when I run
rake cd:create
I get the mysql.sock error.
I'm going insane.. please help
For me I often need to force mysql to not use unix sockets, but regular php sockets.
To do this, connect to 127.0.0.1 instead of localhost. Works 90% of the time, all the time.
Major credit to John P. for helping me get this working last night
The first thing was to uninstall mysql using 'brew uninstall mysql'.
Then to install mysql from their development site. The community .dmg 64 bits version.
Then to find out where the path was pointing.
So in updating the paths he had to find where bin/mysql was and make sure bash_profile had it's path there.
PATH=$PATH:/usr/local/mysql/bin
The essential step after that was to 'source' the file so he had me run this command.
source ~/.bash_profile
From there mysql works flawlessly.

What is forcing my system to look for MySQL in "/opt/local/var/run/mysqld/mysqld.sock"

I have been trying to get a ruby on rails app going on my machine for a little while now for a project I need to work on for work. The issue is, my system must be setting the default location of MySQL somewhere because every time I start the rails webserver (webrick) and run localhost:3000, I get the following error.
"Can't connect to local MySQL server through socket '/opt/local/var/run/mysqld/mysqld.sock' (2)"
I have deleted the installed version of mysql and removed all folders. I reinstalled mysql using BREW. I now have a running mysql instance. The output of "which mysql" prints "/usr/local/bin/mysql" which is actually a sim link to "/usr/local/Cellar/mysql/5.5.14/bin/mysql".
Does anyone know what might be forcing my rails apps to look for mysql in "/opt/local/var/run/mysqld/mysqld.sock"
NOTE: I deleted my current my.cnf because it was messing up the brew version of mysql I currently have running, so I know that is has nothing to do with that.
/opt/local is the default location for MacPorts-installed packages. Chances are you installed rails and or MySQL via MacPorts. Try:
sudo /opt/local/bin/port installed
to see what is installed.

Using XAMPP Install of MySQL with Netbeans 6.8/MySQL Workbench

All,
For all of this I am using Mac OSX Snow Leopard.
I have happily used XAMPP to develop PHP backed sites in the past with no problems(as you'd expect for such a simple to set up package). I am now trying to set up this MySQL install in Netbeans 6.8 (for now just trying to get a sample database backed webapp to run). My issue is that even though MySQL has been started I cannot connect to it at 127.0.0.1 on port 3306 (which it is set up to use).
I have read that the issue is that XAMPP holds MySQl.sock in /Applications/XAMPP/xamppfiles/... whereas MySQL Workbench and Netbeans expects to find it in /tmp/MySQL.sock. Is this correct? I've tried to set up a symbolic link from /tmp to the xmapp directory but this doesn't appear to have changed anything.
Is there anything else I can try/anything that I am missing?
I upgraded from an older version of XAMPP to 1.7.3 and encountered a the same problem, I got MySQL Workbench to connect if I edited the my.ini file and:
changed the socket parameter to:
socket = "TCP/IP"
made mysql bind to an IP address or all IP as in the case below:
enable-named-pipe
bind-address=0.0.0.0
This requires that you disable named-pipe (as shown above)
I could not get this to work. So in case anyone else is reading this and wondering what happened... I installed a non XAMPP instance of the MySQL database and am using that now instead. Less than ideal but it works.