Jan 22

Install and configure a MySQL database server on Debian Squeeze

Category: Linux   — Published by tengo on January 22, 2012 at 12:52 pm


apt-get install mysql-server

to install the MySQL client, server-core, server-5.x and setup the daemon.
A small wizard will come up to ask you basic things.MySQL has its own user-permission system, so it asks for the  database root user's password first.

If the wizard doesn't come up, you can create the root user manually:

$ mysqladmin -u root -p password 'NewMysqlRootPassword'

You can create a database like this

$ mysqladmin -p create TestDatabase

and add users like this (allowing access to the just created db):

$ mysql -u root -p
Enter Password: *****
mysql> create user 'NewUser'@localhost identified by 'NewPassword';
mysql> GRANT ALL PRIVILEGES ON TestDatabase . * TO NewUser@'localhost';
mysql> quit

But keep in mind that the MySQL server is another daemon which might be vulnerable to attackers, so read this about securing the MySQL service.

In terms of performance tuning, you can come back later after some time and run the tuning-primer.sh script (available here) to get automated recommendations on how to fine-tune your setup.

Go here to see the (same) routines for Debian Etch.