PHP & MySQL: N2N - Updated software (MAMP) possibly a problem?

I’ve started on the path from Novice to Ninja. Hopefully, things haven’t changed that significantly in the 5 years since it’s release. I’m still in the software installation phase and ran into a small issue with the instructions on how to change the default password for MySQL local server.

At the bottom of page 18, it describes a php file to open and change the password in. I searched the php file for those lines of code to change. But, I am not having any luck finding them.

It says to find this:
$link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');

The closest thing I can find is:

$socket = 'localhost:/Applications/MAMP/tmp/mysql/mysql.sock';

$link = mysql_connect(

Has this method for changing the default password changed since the program has updated now to v4.1.1? Does anyone know the correct way to do this on the latest version?

Is this even necessary for this training?

Thanks, and sorry for the dumb question…

I wouldn’t bother for developing on my own machine. As the alert box on p17 says, you don’t really need to unless you’re worried about someone hacking into your computer.

Obviously MAMP has changed over the years, so perhaps this tip from their docs will help: Or maybe try this

These days, though, PHP developers have very much moved on from MAMP, recommending things like VirtualBox and Vagrant.

One of the biggest issues you have, from the look of it, is that you’re reading a tutorial that uses the old-style mysql calls such as mysql_connect(). This old library has been deprecated for years, and is removed from the latest version of PHP, in favour of either mysqli or, my preference, PDO. If you’re learning PHP now, forget about that old library and use a more up to date tutorial.

The code you show there isn’t really what I would describe as the code to use to change the default password, it’s just code to connect to the database itself. You would change the passwords used in that code after you have changed the default password using something like phpmyadmin. There may be ways to change the password in code, of course, I’d be surprised if there were not, but to my mind, this early on in the tutorial, the notes are referring to you not using default passwords, anywhere, for anything at all, ever.

Not sure which program you are referring to here. PHP is much, much later than this, as is MySQL itself, MAMP seems to be 3.3.1 at the moment.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.