It is widely used for web applications and a central component of the LAMP open source web application software stack.
To get more information about MySQL, please read this article.
[MySQL in Wiki]
I want to show you how to install MySQL on your Ubuntu machine.
Step 1 : Install MySQL.
Enter following command in terminal to install mysql-server and php5-mysql.$ sudo apt-get install mysql-server php5-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: kde-l10n-ko language-pack-kde-en language-pack-kde-ko language-pack-kde-en-base kde-l10n-engb language-pack-kde-ko-base Use 'apt-get autoremove' to remove them. The following extra packages will be installed: libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-server-5.5 php5-common php5-fpm Suggested packages: libipc-sharedcache-perl tinyca mailx php5-suhosin php-pear The following NEW packages will be installed: libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-server mysql-server-5.5 php5-common php5-fpm php5-mysql 0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded. Need to get 21.3 MB of archives. After this operation, 72.9 MB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://kr.archive.ubuntu.com/ubuntu/ precise/main libnet-daemon-perl all 0.48-1 [43.1 kB] Get:2 http://kr.archive.ubuntu.com/ubuntu/ precise/main libplrpc-perl all 0.2020-2 [36.0 kB] Get:3 http://kr.archive.ubuntu.com/ubuntu/ precise/main libdbi-perl i386 1.616-1build2 [849 kB] Get:4 http://kr.archive.ubuntu.com/ubuntu/ precise/main libdbd-mysql-perl i386 4.020-1build2 [104 kB] Get:5 http://kr.archive.ubuntu.com/ubuntu/ precise/main libterm-readkey-perl i386 2.30-4build3 [28.4 kB] Get:6 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-5.5 i386 5.5.40-0ubuntu0.12.04.1 [8,047 kB] Get:7 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-5.5 i386 5.5.40-0ubuntu0.12.04.1 [8,709 kB] Get:8 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main php5-common i386 5.3.10-1ubuntu3.15 [163 kB] Get:9 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/universe php5-fpm i386 5.3.10-1ubuntu3.15 [3,134 kB] Get:10 http://kr.archive.ubuntu.com/ubuntu/ precise/main libhtml-template-perl all 2.10-1 [65.0 kB] Get:11 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server all 5.5.40-0ubuntu0.12.04.1 [11.3 kB] Get:12 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main php5-mysql i386 5.3.10-1ubuntu3.15 [73.3 kB] Fetched 21.3 MB in 5s (3,756 kB/s) Preconfiguring packages ... Selecting previously unselected package libnet-daemon-perl. (Reading database ... 198177 files and directories currently installed.) Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.48-1_all.deb) ... Selecting previously unselected package libplrpc-perl. Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ... Selecting previously unselected package libdbi-perl. Unpacking libdbi-perl (from .../libdbi-perl_1.616-1build2_i386.deb) ... Selecting previously unselected package libdbd-mysql-perl. Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.020-1build2_i386.deb) ... Selecting previously unselected package libterm-readkey-perl. Unpacking libterm-readkey-perl (from .../libterm-readkey-perl_2.30-4build3_i386.deb) ... Selecting previously unselected package mysql-client-5.5. Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.40-0ubuntu0.12.04.1_i386.deb) ... Selecting previously unselected package mysql-server-5.5. Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.40-0ubuntu0.12.04.1_i386.deb) ... Selecting previously unselected package php5-common. Unpacking php5-common (from .../php5-common_5.3.10-1ubuntu3.15_i386.deb) ... Selecting previously unselected package php5-fpm. Unpacking php5-fpm (from .../php5-fpm_5.3.10-1ubuntu3.15_i386.deb) ... Selecting previously unselected package libhtml-template-perl. Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.10-1_all.deb) ... Selecting previously unselected package mysql-server. Unpacking mysql-server (from .../mysql-server_5.5.40-0ubuntu0.12.04.1_all.deb) ... Selecting previously unselected package php5-mysql. Unpacking php5-mysql (from .../php5-mysql_5.3.10-1ubuntu3.15_i386.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... Setting up libnet-daemon-perl (0.48-1) ... Setting up libplrpc-perl (0.2020-2) ... Setting up libdbi-perl (1.616-1build2) ... Setting up libdbd-mysql-perl (4.020-1build2) ... Setting up libterm-readkey-perl (2.30-4build3) ... Setting up mysql-client-5.5 (5.5.40-0ubuntu0.12.04.1) ... Setting up mysql-server-5.5 (5.5.40-0ubuntu0.12.04.1) ... 141226 14:24:10 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. mysql start/running, process 3940 Setting up php5-common (5.3.10-1ubuntu3.15) ... Setting up php5-fpm (5.3.10-1ubuntu3.15) ... update-rc.d: warning: php5-fpm stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (none) Creating config file /etc/php5/fpm/php.ini with new version Setting up libhtml-template-perl (2.10-1) ... Setting up mysql-server (5.5.40-0ubuntu0.12.04.1) ... Setting up php5-mysql (5.3.10-1ubuntu3.15) ...
In the middle of this installation, you can see the following screen.
Please enter root password to initiate root password of MySQL.
You should enter it twice like every password initiation process.
Step 2 : Initialize MySQL data directory.
To initiate MySQL data directory. In this step, you can see the some important information about MySQL. Please check the messages after entering 'sudo mysql_install_db' command.$ sudo mysql_install_db Installing MySQL system tables... 141226 14:35:35 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. OK Filling help tables... 141226 14:35:37 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 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/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h your-server-name password 'new-password' Alternatively you can run: /usr/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 ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/
To improve MySQL security, enter "sudo mysql_secure_installation".
To get more information about this command, please click here [mysql_secure_installation]
$ sudo mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
Using service command, you can check your MySQL is installed and already working on your Ubuntu.
$ service mysql status
mysql start/running, process 3940
No comments:
Post a Comment