Monday, April 30, 2012

Set / Change / Reset the MySQL root password on Ubuntu Linux

 Tested On

- Ubuntu Linux 7.10 Gutsy Gibbon and MySQL 5.0.45. (2007-10-21)
- Ubuntu Linux 6.06 Dapper Drake and MySQL 4.1.15.
- Ubuntu Linux 10.04 LTS Mysql 5.1


Wednesday, April 4, 2012

Virtual hosting with IIS

Virtual hosting with IIS (Internet Information Services)

NOTE: Only IIS versions for Windows Server and Windows Vista support multiple web-sites as described below.

If you are using Windows 98, Me, NT4 Workstation, Windows 2000 Professional, or Windows XP please see reference article below instead.

"Virtual hosting" means hosting multiple web-sites with different domain names on the same IP address.

This procedure is also described in Microsoft KB article Q190008

From the "Internet Information Services (IIS) Manager" window, right click on a web-site, and select "Properties":

Image1.png

In the web-site Properties dialog, click the "Advanced..." button:

Image2.png

In the "Advanced Web Site Identification" dialog, select the first "identity", and click the "Edit" button:

Image3.png

Enter the web-site domain name in the "Host Header Name" field:

Image4.png

Click the OK button in all the dialogs to save your changes.

Create additional web sites the same way.


Thanks to http://www.simpledns.com/kb.aspx?kbid=1149

Monday, March 26, 2012

Monitor All SQL Queries in MySQL


Microsoft’s SQL Server has a tool called Profiler that you can use to monitor every SQL query that hits the database. This is extremely useful for programmers as well as database administrators to troubleshoot the exact queries generated by an application.

Having switched to using MySQL on a frequent basis, this was one of the first things I wanted to figure out how to do. How else can you see the actual SQL code generated by WordPress or phpBB?

The first thing we’ll need to do is turn on logging of queries in MySQL. Be warned that this should only be done in development… it really slows things down to log every single query to a file.

Find and open your MySQL configuration file, usually /etc/mysql/my.cnf on Ubuntu. Look for the section that says “Logging and Replication”

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.

log = /var/log/mysql/mysql.log

Just uncomment the “log” variable to turn on logging. Restart MySQL with this command:

sudo /etc/init.d/mysql restart

Now we’re ready to start monitoring the queries as they come in. Open up a new terminal and run this command to scroll the log file, adjusting the path if necessary.

tail -f /var/log/mysql/mysql.log

Now run your application. You’ll see the database queries start flying by in your terminal window. (make sure you have scrolling and history enabled on the terminal)

I’m impressed, phpbb3 has fairly tight, optimized SQL code. WordPress, on the other hand, is very inefficient.

Taken & credit to http://www.howtogeek.com/howto/database/monitor-all-sql-queries-in-mysql/

Wednesday, March 21, 2012

FreeBSD: Upgrade from 8.2 to 9.0

If you use this command to upgrade to latest release FreeBSD 9.0:

$ freebsd-update -r 9.0-RELEASE upgrade

You might see following error:

The update metadata is correctly signed, but failed an integrity check. Cowardly refusing to proceed any further.

This error indicate that it cannot accept % and @ characters which appear in FreeBSD 9 . To overcome this, run following command:

$ sed -i '' -e 's/=_/=%@_/' /usr/sbin/freebsd-update

Now start the upgrade process:

$ freebsd-update -r 9.0-RELEASE upgrade

Accept all prompted values and follow the wizard. This process downloads all files and patches required for upgrade so it takes time. You might need to press ‘Enter’ once to check /etc/hosts file. Once complete, run following command to start installing the updates:

$ freebsd-update install

After a while, you should see the system will prompt something as below:

Installing updates...rmdir: ///boot/kernel: Directory not empty   Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.

Reboot the server:

$ init 6

Once up, it will boot to FreeBSD 9. Run again the installation command:

$ freebsd-update install

After the process completed, the system will ask you to build back all your application which installed using ports. Once done, you need to rerun again the above command to complete the upgrade process and you should something like below:

$ freebsd-update install Installing updates... Done

Your update should be completed now. To check the new version, run following command:

$ uname -r 9.0-RELEASE

Credit to : http://blog.secaserver.com/2012/02/freebsd-upgrade-8-2-9-0/

Tuesday, March 6, 2012

repairing mysql database

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases