Monthly Archives: January 2010

MySQL root password fails or forgotten

I had setup a new Ubuntu server with MySQL and during the install I was sure I knew the password I set for the mysql root user.

So I then setup webmin and went to access mysqladmin and it failed. I then tried at the command line and it failed.

So I am stuck with a running but inaccessible mysql server.

This thread at Trap17 was the one that helped but it was missing a couple of key points.

I’ll repeat it here in case the link goes away in the future. If you are using Ubuntu without a root password you will need to prefix some of the following with the ‘sudo’ command so that they will run ok.

First stop mysql

/etc/init.d/mysql stop

Then run this command that basically says “run mysql without password control”

mysqld_safe –skip-grant-tables &

With my server this resulted in not returning to the command prompt. Press “Enter” to get the command prompt again.
Then open up mysql for a mysql prompt

mysql -u root -p

Which should result in a mysql> command prompt

From the original post this next command appears redundant on Ubuntu so skip this one. mysql client – mysql -u root

The next command is done at the mysql prompt and again I differ from the original post

use mysql;

Note the semi-colon to complete the command. If you do copy and paste the two lines successfully then skipping the semi-colon on the first line is ok, but I like most people will initially try to do it a line at a time so I think it is clearer to execute as a sequence.

The next command sets up your new password and you need to edit this line with your new password and your relevant user account name.

update user set password=PASSWORD(”NEW-ROOT-PASSWORD”) where User=’root’;

Ok, so now you possibly have an error. Depending on the way you held your lips you may or may not have the correct syntax copied to your command line. I am not sure if this is consistent with all browsers and all telnet clients but I use PuTTy and when I copy/paste the above from the original thread I get this

update user set password=PASSWORD(.NEW-ROOT-PASSWORD.) where User=.root.;

Note that the quote marks in the command were converted to a ‘.’ (period) character and when I hit the enter key I got an error

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1

So if you check your syntax and make sure you have the quotes correctly placed then it will work fine.

Finish up by closing the mysql command line with ‘exit’ and stop / start mysql to get it to use passwords again.

/etc/init.d/mysql stop

/etc/init.d/mysql start

And that should get your account running again.

osCommerce and stock control

Ok, so I use osCommerce (and CRELoaded) and I want stock control and probably a general ledger connection. So where do I look and what do I find.

Store Manager by Magnetic One
is an application I have been aware of for a couple of years but not really used or in my view needed. It is not a stock control(SC) or general ledger (GL) but a method to allow windows users to update their CRELoaded system without using the web interface.

This blog provides a quick summary of 10 open source ERP / GL type solutions. I have yet to check these out.

This might work. ADempiere ERP Business Suite is an open source version of Compiere which, despite claiming as open source, has a fee for getting the source code which is pretty much an oxymoron.

SugarCRM web.config IIS7 and Error 500: Internal Server Error

I’d started to deploy a test version of SugarCRM 5.5 CE and an updated PHP 5.2.12 to a Windows 2008 server with IIS7 when I got an internal server error 500.

What I found, eventually, was that while the installation of Sugar completed, the installation creates a web.config file that includes an instruction to ‘Add default document type’ of index.php to the site.

The problem was that my server level settings already included index.php as a default document. The only reason I found it was when checking all the settings for the site in the IIS7 Manager it gives an error in the manager about the double up not being possible.

Would have been more polite if IIS could simply accept that the index.php already is a default document and ignore it politely instead of doing a dummy spit type error and not running.

In this case I just deleted the instruction to Add in the web.config.

Another option is to include a instruction in the web.config to clear any existing default pages prior to adding the one(s) required for the current application. Like this:

Logged as a Bug at Sugar BugTracker

SugarCRM 5.5 Install Error Session Save Path

Using a PHP setup on a Windows 2008 server as per the FastCGI instruction set I found that installing Sugar 5.5 stopped at the SystemCheck page (install/installSystemCheck.php) with a message that the message

The session.save_path setting in your php configuration file (php.ini) is not set or is set to a folder which did not exist. You might need to set the save_path setting in php.ini or verify that the folder sets in save_path exist.

The general comments on searching for ideas were that the is_dir function fails regardless of the existence or otherwise of the directory.

I delved a bit deeper and confirmed that the is_dir function is restricted by the openbase_dir setting and if the session.save_path is outside the openbase_dir setting then it is not found.

I also noted that the php chdir function is limited to the openbase_dir setting.

Using multiple values in the openbase_dir setting does not work either as apparently is_dir ignores the secondary setting.

In any case the only way around this is appears to be to have the session.save_path within the openbase_dir path.