Installing MySQL 5.5 on Ubuntu 11
The package manager for Ubuntu 11 installs MySQL 5.1.
Read instructions from mysql and here to install 5.5.
Step #1. Download
1. Browse to: http://dev.mysql.com/downloads/mysql/5.5.html
2. Choose: Linux Generic
3. Download: Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive
Step #2. Create mysql user and group
$ sudo groupadd mysql $ sudo useradd -r -g mysql mysql
Step #3. Install files to /usr/local/mysql
$ cd /usr/local $ sudo tar zxvf /path/to/mysql-VERSION-OS.tar.gz $ sudo ln -s full-path-to-mysql-VERSION-OS mysql $ cd mysql $ sudo chown -R mysql . $ sudo chgrp -R mysql .
Step #4. Install Async IO library
$ sudo apt-get install libaio1
Step #5. Run mysql install script
$ sudo scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/mysql/bin/mysqladmin -u root -h ubuntu password 'new-password' Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!
Step #6. Add to path
$ sudo vi /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/mysql/bin"
Step #7. Create the socket directory
Setting the correct permission on the socket directory is very important, otherwise MySQL would not run.
$ sudo mkdir /var/run/mysqld/ $ mkdir: cannot create directory `/var/run/mysqld/': File exists $ sudo chown -R mysql:mysql /var/run/mysqld/
Step #8. Config Settings
Create configuration
$ cp support-files/my-medium.cnf /etc/my.cnf
Add settings in /etc/my.cnf
[client] #password = your_password port = 3306 socket = /var/run/mysqld/mysqld.sock #/tmp/mysql.sock # The MySQL server [mysqld] user = mysql port = 3306 socket = /var/run/mysqld/mysqld.sock basedir = /usr/local/mysql datadir = /usr/local/mysql/data tmpdir = /tmp log_error = /var/log/mysql/error.log
Step #9. Remove the MySQL files from the older version
$ sudo rm -R /var/lib/mysql $ sudo rm -R /etc/mysql $ sudo rm -R /usr/lib/mysql
Step #10. Start Server
From the terminal …
$ sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
At startup as a service …
$ cd /usr/local/mysql/support-files/ $ sudo cp mysql.server /etc/init.d/mysql $ sudo chmod +x /etc/init.d/mysql $ sudo update-rc.d mysql defaults # Starting $ sudo service mysql start # Stopping $ sudo service mysql stop
Log file will be kept at /var/log/mysql/error.log
Step #11. Secure Server
$ sudo /usr/local/mysql/bin/mysql_secure_installation