These instructions are for MySQL 5.1 on our Debian 6 system.
Install MySQL along with its pre-requisites:
sudo apt-get install mysql-common mysql-client mysql-server
You'll be prompted to enter a password for the root MySQL user.
NOTE: The MySQL documentation is non-free, and not included with Debian. Use the online documentation provided at MySQL's site.
Set the password for MySQL root user. (If this doesn't work, rename your
.my.cnf file temporarily and try again).
MYSQL_ROOT_PASSWORD="$(openssl rand 15 -base64 | tr '+/' '-_')" sudo mysqladmin -u root password "$MYSQL_ROOT_PASSWORD"
Create root's MySQL configuration file, and make sure nobody else can read it:
sudo touch /root/.my.cnf sudo chmod 0600 /root/.my.cnf
/root/.my.cnf file to set the password when using various client programs:
sudo sh -c 'cat >> /root/.my.cnf' <<EOF [mysql] user = 'root' password = '$MYSQL_ROOT_PASSWORD' [mysqladmin] user = 'root' password = '$MYSQL_ROOT_PASSWORD' EOF
I wanted to install mysql-doc package too, but it doesn't seem to exist even in the non-free section. This appears to be due to the MySQL corporation's licensing.
The Debian installation creates a MySQL user named "debian-sys-maint". This MySQL account is used in the start/stop and cron scripts. Don't delete it.
/usr/share/doc/mysql-server-5.0/README.Debian.gz for more information.
Could probably use some tuning and routine maintenance.