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…

Lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible.

In this tutorial I will show you how yo install Lighttpd on Debian with PHP-FPM and MySQL support.

Step1. Install MySQL

apt-get install mysql-server mysql-client libmysqlclient16

Make sure that you provide a strong password for the MySQL root user.

Step2. Install Lighttpd on Debian

apt-get install lighttpd

You can access now this page http://localhost/index.lighttpd.html from your browser and you should see the Lighttpd default page


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:

[email protected]:~# groupadd mysql
[email protected]:~# useradd -r -g mysql mysql

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

[email protected]:~# apt-get install libaio1

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

[email protected]:~# cd /usr/local
[email protected]:/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)

Percona is glad to announce the release of Percona Server 5.1.60-13.1 on December 16, 2011 (Downloads are available from Percona Server 5.1.60-13.1 downloads and from the Percona Software Repositories).

Based on MySQL 5.1.60, including all the bug fixes in it, Percona Server 5.1.60-13.1 is now the current stable release in the 5.1 series. All of Percona ‘s software is open-source and free, all the details of the release can be found in the 5.1.60-13.1 milestone at Launchpad.

Bug Fixes

  • SHOW SLAVE STATUS could give incorrect output with master-master replication and using SET user variables. This could only occur with a sever having both master-master replication and --log-slave-updates enabled. This is also filed in MySQL bug tracker, but not fixed in upstream MySQL at the time of this Percona Server release. Bug Fixed: #860910 (Alexey Kopytov)
  • MyISAM repair-by-sort buffer cannot be more than 4GB even on 64bit architectures. With this bug fix, both the server option --myisam-sort-buffer-size and the |myisamchk| --sort-buffer-size can be set to values over 4GB on 64bit systems. For users with large MyISAM tables, this could be a great improvement in |myisamchk|, CREATE INDEX and ALTER TABLE performance. Bug Fixed: #878404 (Alexey Kopytov)
  • The atomic operations used in Response Time Distribution on 32bit systems could (in theory) be optimized incorrectly by the compiler. This has not been observed in the wild and may only be an issue with future compilers. With this bug fixed, we have corrected the inline assembly to always produce correct compiled code even if future compilers implement new optimizations. Bug Fixed:#878022 (Laurynas Biveinis)
  • GCC 4.6 has expanded diagnostics and compiler warnings. We have audited and fixed these warnings for Percona Server 5.1, finding that the warnings were benign. Bug Fixed #878164(Laurynas Biveinis)
Page 1 of 212