Tuesday, November 30, 2010

MySQL Workbench XAMPP system error: 61

Here comes another one!
Today the Workbench threw this in my face:
Lost connection to MySQL server at 'reading initial communication packet', system error: 61
It seems that XAMPP is really serious about security. Kinda odd considering that everybody uses it for development and not production...
So it comes with the skip-networking option enabled by default :p
That doesn't bother php but it does break the MyQL Workbench. So you need to disable it. In Terminal:
vi /Applications/XAMPP/etc/my.cnf
Arrow down to the line after [mysqld] that says
and put a # in front so it looks like
use the XAMPP panel to stop and start MySQL again.
Now the MySQL Workbench should connect fine to localhost.

Note: I did not need to add
but if the above fails for you then put that in also.
Maybe it'll work.

Sunday, November 28, 2010

XAMPP access denied for root with NO password

So far XAMPP is great for localhost web development. No problems with tweaking it or deploying local developed stuff on robust systems like OpenSUSE or CentOS. Works on Windows and Mac.
Well it works until it doesn't. And when it stops working u start digging :D
Today it was MySQL that said NO. I will not allow this nonsense of logging in as root and using NO password!
Access denied for user 'root@localhost' (using password: NO)

Ok, I must admit!
This is somehow understandable. Root with no password is plain BAD.
But I am ROOT! And this is my DEV box! And YOU are free software! Community edition!
So WHO changed my root password!?
It was blank yesterday and worked just fine!
This had happened before. Sabotage I say!

Yes. Seems that on OSX at least when the system feels like it the root blank pass gets messed up.
So you need to change it back to your old one. My old one is blank. On XAMPP follow these steps:
  1. make sure mysql is running using the XAMPP admin panel
  2. fearlessly open a terminal window and type ps -aux | grep mysqld_safe
  3. copy the line starting from /bin/sh /Applications/XAMPP/xamppfiles/bin/mysqld_safe ... to the end (mine ends with .local.pid)
  4. stop mysql from the panel
  5. in terminal paste the copied command and append  --skip-grant-tables at the end so we start a mysqld without the user / table security restrictions
  6. open another terminal tab/window, go to the bin folder of XAMPP (cd /Applications/XAMPP/xamppfiles/bin) and type ./mysql -u root
  7. in the mysql prompt that opens type:
  8. use mysql;
  9. update user set password=PASSWORD("YOUR_PASS_HERE") where user='root';
  10. flush privileges;
  11. quit
  12. stop mysql from the panel
  13. start mysql again
The above steps should allow you to log in with the password you entered instead of the above YOUR_PASS_HERE. If that was PASSWORD("") it will allow you to log in as root with no password.
Please note that his is a somewhat advanced level of usage meant for the beginner XAMPP user who just wants the thing to work. So proceed with caution and make sure you copy, paste and type the correct commands and nothing more. The above commands directly modify the mysql database which is the core of the database system. So proceed with caution and think before you type ;)

Update 20.01.2011: Well I just did an OSX update (which gave me the quite nice App Store) and the blank root password got messed up again. Following the above steps fixed it so the process works. Now I'm trying to remember if I did a reboot since I wrote that. I think I did so that would mean that a system update would mess the password? Doesn't make sense but it would be good if that happens _only_ on OSX updates and not regular reboots. But maybe it's just random as all the good things in life...

Sunday, November 07, 2010

OS X XAMPP permissions

Just a quick note to tone down my previous post about how easy is to move to a new OS X version.
As far as I can remember I hit this problem with 10.5 Leopard as well when using XAMPP.
The bottom issue was that the darn php is_writable and siblings were always complaining that they cannot read or write to the file system. Even after chmod 777 from the DocumentRoot up.

My solution is to change the user Apache runs under. The default is nobody:nogroup and this doesn't go well with OS X. So i just modified in /Applications/XAMPP/xamppfiles/etc/httpd.conf lines 138 and 139 adding my user.name and "staff" as group. On 10.5 the group was named differently.  Just do an
id -p
in terminal and take the user name and first group name from there. Interesting group name choice from Apple for it's OS users. Staff :)

On a second thought maybe this is a start Apache OS X requirement that you should actually add a new apache user and edit the file. But I'm pretty ok with Apache running as me because I really want it to be able to access all my files. Well ahm, not all but I trust it'll stay inside it's DocumentRoots.

And please don't send me any exploits disguised as php tricks to run locally so you can own me :D

Snow is coming. Snow Leo is already here!

In order to celebrate the fast coming of the white season I installed myself a brand new and fresh Snow Leopard!

Well not really...
My old MBP was having the blank screen of death Nvidia issue and it had to go back to the green fields of Bavaria to the nice Apple support guys in Landshut. Who so happens also fixed my current MBP for the same issue. I still wonder how long would the Apple support guys here in Cluj would have laughed if I would have called them about a MBP bought from the States :)

The nice surprise about Snow Leo is that it works good. In a couple of hours I managed to rebuild my entire setup with all the old apps.
I found that XAMPP 1.7.3 is out, is slicker and it has a lot of nice updates.
Also Virtualbox appliances export - import just works.
That Quicksilver still rocks in the Snow.
And I've got Eclipse Helios. That's bleeding edge baby!

Overall the thing feels more polished and faster. Like a new Mac should feel :)