In this article I will show you some MySQL commands with examples.

1. MySQL Set Root Password

You can set the mysql root password from command line like this:

mysqladmin -u root password your_password

You can also change mysql root password if you forgot it using this tutorial: How to Recover MySQL Root Password

2. Change MySQL Users Passwords from the command line

mysqladmin -u mysql_username -h mysql_host -p password 'new_mysql_password'

3. How To Connect to Local MySQL Server

This is how you connect to your local MySQL server from the command line:

mysql -u root -p

4. Create a MySQL Database

The following command will create a new MySQL database after you are connected:

create database debiantutorials_db;

5. Backup MySQL Database with mysqldump

Backup a database to a .sql file:

mysqldump -u root -p debiantutorials_db > debiantutorials_db.sql

You can also compress the database with gzip on the fly while you are dumping:

mysqldump -u root -p debiantutorials_db | gzip -v > debiantutorials_db.sql.gz

6. Mysqldump and Skip Table

You want to dump a mysql database with one or more crashed tables and you get an error like this? Continue Reading…

Recently I upgraded the MySQL server and I enabled InnoDB and then I was not able to start the MySQL Server.

The next step was to check the mysql logs and I saw the error:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5256780 bytes
InnoDB: than specified in the .cnf file 0 1077645824 bytes!
[ERROR] Plugin ‘InnoDB’ init function returned error.
[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

The solution for this error is:

Remove the ib_logfile0 and ib_logfile1 files located in /var/lib/mysql.

rm /var/lib/mysql/ib_logfile0
rm /var/lib/mysql/ib_logfile1 Continue Reading...

Cherokee is a high performance WebServer and is released under GNU license. Cherokee webserver is developed in C language and is available for all major distributions. Compared with all other webservers, Cherokee is having a major feature. It offers graphical admin interface for managing all tasks.

In this article I will show you how to install Cherokee on Debian with MySQL and PHP5 support.

Step1. First we need to install MySQL.
Install MySQL Server and Client using the following command:

root@cherokee:/# apt-get install mysql-server mysql-client

and follow onscreen instructions.

Step2. Install PHP5 and add FastCGI support. This is needed by Cherokee webserver.

root@cherokee:/# apt-get install php5 php5-cgi php5-mysql php5-gd php5-curl php-pear php5-imagick php5-memcache php5-xmlrpc php5-xsl

Now open /etc/php5/cgi/php.ini file and uncomment the cgi.fix_pathinfo=1 line.

Step3. Installing Cherokee Web Server in Debian: Continue Reading…

How To Install MySQL 5.6 On Debian

Valic —  December 31, 2012 — 2 Comments

MySQL 5.6 will add more performance improvements over MySQL 5.5. MySQL 5.6 is not stable yet but I will show you how to install MySQL 5.6.8rc on Debian if you want to test it.

Step1. Add a group and an user for MySQL called mysql:

root@testing:~# groupadd mysql
root@testing:~# useradd -r -g mysql mysql

Step2. Install the libaio1 library package. This is used by MySQL:

root@testing:~# apt-get install libaio1

Step3. Download MySQL 5.6.8rc version in /usr/local location:

root@testing:~# cd /usr/local
root@testing:/usr/local# wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
2012-12-30 16:11:31 (5.10 MB/s) - `mysql-5.6.8-rc-linux2.6-x86_64.tar.gz' saved [293210851/293210851]

Step4. Unpack the MySQL archive and rename it to mysql: Continue Reading…

I just enabled InnoDB on my  MySQL server and I’ve made the necessary changes into my.cnf. When I restarted the MySQL server I got the following error in the log:

InnoDB: The InnoDB memory heap is disabled

After  some checking I’ve found that I need to set the value of innodb_use_sys_malloc to 0. After I added  this entry innodb_use_sys_malloc =  0 into the my.cnf and restarted the MySQL Server the error was gone.

NOTE: More info here: (see page 38)