Its easy to install MySQL on ubuntu but you must have updated your repository for apt-get utility. If you haven’t than run below command to update it.
shell> apt-get update
After that, to install MySQL 5.1 on ubuntu run below command.
shell>sudo apt-get install mysql-server-5.1
you’ll have to give your password so it will start MySQL installation with downloading the required packages.
user@shell:# sudo apt-get install mysql-server-5.1
In between this process, it will ask to set root password for mysql. You can set it and go next.
Now, installation is done you can login into server with root user and password.
user@shell:# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 39 Server version: 5.1.49-1ubuntu8.1 (Ubuntu) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | +--------------------+ 2 rows in set (0.00 sec) mysql>
Its preferable that after installation, you should run mysql_secure_installation script for secure the MySQL server.
With that script, you can set/change root password, remove anonymous users, disallow root login remotely, remove test database & access to it and reload privilege tables.