MAMP 3.1 and MySQL PDO - mysql

I just grabbed the latest version of MAMP Pro (3.1) and installed it only to find that it removes MySQL PDO entirely. That's a problem since the framework I'm using requires PDO to connect to the database. I tried grabbing the extensions from the old version of MAMP, but it immediately throws errors.
How do I get MySQL PDO back for MAMP 3.1? I've looked on the site and can't find a downloads page to roll back to the older version.

In MAMP 3.1, they've made the switch to mysqlnd which actually includes mysql, mysqli, and PDO. The problem is that they've removed all the PDO settings in php.ini because they aren't using the MySQL PDO extension. Because of this change, from the command line, PHP is looking at the wrong MySQL socket file. To fix this, I updated the php.ini file with the following line:
pdo_mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock
After that, everything started working again.
If anyone from Appsolute sees this, PLEASE re-add the PDO settings to the INI files so this sort of thing doesn't happen!

Related

setup mysql for wordpress manually

I installed mysql and apache. Apache is serving wordpress correctly and I want to install wordpress via install.php. This fails at setup step 2 after inserting database name, user and password (error 500).
I suspect that I haven't correctly finished the mysql database setup.
So to check, I log in to mysql via mysql -u root -p and run select database(); which returns null. So there is no database. Then when I call create database wordpress it says the db already exists. So what??
Just in case someone asks why not use xampp or wamp or the like: I want to set up everything by hand to learn the basics.
System setup: Windows 8.1 64 bit, mysql 5.7.21, apache 2.4, php 7.2.4 w/ thread safe
In the php.ini file you have to enable two settings:
extension = mysqli
extension_dir = "ext"
The root cause was that I had only activated the extension setting.
The website where I found this tip did not mention the requirement to also set the extension directory.
The final solution is from the official guide to install mysqli, which is very misleading in this regard:
For PHP > 5.3 it says
On Windows, for PHP versions 5.3 and newer, the mysqli extension is
enabled and uses the MySQL Native Driver by default. This means you
don't need to worry about configuring access to libmysql.dll.
But this was not true for me. It did not work out of the box.
For older versions (e.g. ones which should not affect my version) it says
As with enabling any PHP extension (such as php_mysqli.dll), the PHP
directive extension_dir should be set to the directory where the PHP
extensions are located. See also the Manual Windows Installation
Instructions. An example extension_dir value for PHP 5 is c:\php\ext.
This was the final hint that got it working.

MySQL Workbench incompatible/nonstandard server

I am new to using MySQL and I needed to download it for school, however, I keep getting this error message (picture below). I am using xampp and connecting using the username root. the port also matches what it is telling me. It will let me proceed but a lot of the features are missing. Any help at all would be appreciated.
Incompatible/nonstandard server version or connection protocol
detected (10.0.10).
A connection to this database can be established but some MySQL
Workbench features may not work properly since the database is not
fully compatible with the supported versions of MySQL.
MySQL Workbench is developed and tested for MySQL Server versions 5.1,
5.5, 5.6 and 5.7
As I can see, You are using latest XAMPP.
All you need to do is, after opening MySQL Workbench, and instead of setting up a new connection, Press CTRL+R or click on DATABASE tab in the top menu. Select Reverse Engineer and provide necessary information. You are good to go now.
The MySql workbench wont crash or show any compatibility issue now.
The current version of XAMPP uses MariaDB instead of MySQL.
Because MySQL Workbench is designed to work with MySQL and not with the very similar drop in replacement MariaDB, you are gonna have problems ...
So, if you want to use MySQL Workbench with XAMPP then a solution would be to try installing the last version of XAMPP that uses MySQL. That version is probably 1.8.3 from (August of 2014?). You can download it here:
XAMPP Sourceforge old versions
If you are using the latest XAMPP that uses MariaDB, in that case in your MySQL Workbench don't use 'Connect to Database' instead use 'Reverse Engineer' and provide the necessary credentials. That's all, No hassle.
I encounter the same message followed by a crash of MySQL Workbench, with version 6.3.7 (build 1199).
I didn't find a solution, but here is a work-around:
Once you press the button Continue anyway, just open a database use toto, and then wait a bit (a minute is enough in my case), and then you can call a query without a crash. I found this trick here.
I experimented the same with WAMP 3.2.0.
MariaDB was configured to listen to port 3306 (the usal MySQL port) and MySQL 8 was listening on port 3308. If you are in this case, don't be fooled by the fact you have 2 DBs.
To solve this, you have to choose the DB you want. I wanted MySQL and I just ask MySQLWorkBench to open a connection on port 3308 to MySQL.
You can ditch MySQL Workbench, and use the browser made for the MariaDB, they have a free version here: https://www.upscene.com/downloads/dbw
It's limited in its abilities, but I had no troubles connecting and browsing.
I had the similar problem because i was using Denwer at the same time.
To solve the problem:
Stop Denwer
Restart MySQL server
Profit! Now you can open your database in the Workbench
The idea is that denwer was starting its local server which didnt allow MySQL to start normally.
If you want to use denwer at the same time wth MySQL you can just start it after MySQL (Point 4).
In my case I already had MySql server and workbench installed and setup prior to my XAMPP installation. I wanted to continue with my existing setup.
I also installed MySql server with my XAMPP. I started mysql inside XAMPP and when I connected to MySql Workbench, I encountered the same error. Because Workbench was trying to connect with the server which was installed with XAMPP, apparently this was incompatible.
So I stopped mysql in XAMPP and started started mysql server manually(the previous setup and installed server).
Refer this to know how to start mysql manually in windows.
You can also config XAMPP to use your existing SqlServer.
So I had the same problem. For me none of the methods worked, but then I found out that my MariaDB was occupying the same port, so I uninstalled it and that solved the problem.
i had same issue, i changed the mysql server port from 3306 to 3308 in XAMPP config file.
[mysqld]
port=3308

Using old MYSQL passwords with php 5.3

I have a problem where I am trying to connect to old database with new php5 and getting
mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password').
Everyone appears to solve this problem through making changes to either database config file or rehashing their passwords.
Catch is, I cannot do either at the moment. I would like to know if there is a way to make php5 use old passwords.
Given your constraint, your only option is to recompile PHP against the libmysqlclient library (instead of the default, native PHP mysqlnd). Try the "Linux-Generic" "Development Libraries" binaries provided by MySQL.
You might need to use an older version of libmysqlclient, I am not sure the newer versions still support the old authentication method.

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.

Getting mysqlnd error when using Snow Leopard's Apache

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