Friday 15 May 2015

How to install mysql in ubuntu

How to install mysql in ubuntu


1) Logged in as super user
2) Type following command to install
sudo apt-get install mysql-server


3) It will ask for an option say yes
4) After installation it will ask for password - set password
5) Confirm password again
Now check the status of SQL server
1) To start service use
sudo service mysql start
2) To check status of servce use following command
sudo service mysql status
3) To go on SQL terminal use following command
mysql -uroot -pXXXXX


XXXXX - put your password
4) Once connected you can verify and check. For example running following command
mysql> show databases
-> ;
+--------------------+
| Database        |
+--------------------+
| information_schema |
| mysql           |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


mysql>
Complete logs are as follows
**************************


oyeweb@oyeweb-Latitude-3540:/var$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
 linux-generic-lts-quantal
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
 libmysqlclient18:i386 libterm-readkey-perl mysql-client-5.5
 mysql-client-core-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
 libmldbm-perl libnet-daemon-perl libplrpc-perl libsql-statement-perl
 libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
 libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-server
 mysql-server-5.5 mysql-server-core-5.5
The following packages will be upgraded:
 libmysqlclient18:i386 mysql-common
2 upgraded, 10 newly installed, 0 to remove and 216 not upgraded.
Need to get 9,900 kB of archives.
After this operation, 96.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.43-0ubuntu0.14.04.1 [13.8 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main libmysqlclient18 i386 5.5.43-0ubuntu0.14.04.1 [593 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main libmysqlclient18 amd64 5.5.43-0ubuntu0.14.04.1 [596 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu/ trusty/main libdbi-perl amd64 1.630-1 [879 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu/ trusty/main libdbd-mysql-perl amd64 4.025-1 [99.3 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu/ trusty/main libterm-readkey-perl amd64 2.31-1 [27.4 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-core-5.5 amd64 5.5.43-0ubuntu0.14.04.1 [709 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-5.5 amd64 5.5.43-0ubuntu0.14.04.1 [1,590 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-core-5.5 amd64 5.5.43-0ubuntu0.14.04.1 [3,221 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-5.5 amd64 5.5.43-0ubuntu0.14.04.1 [2,093 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu/ trusty/main libhtml-template-perl all 2.95-1 [65.5 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server all 5.5.43-0ubuntu0.14.04.1 [12.2 kB]
Fetched 9,900 kB in 50s (195 kB/s)                                             
Preconfiguring packages ...
(Reading database ... 249974 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.43-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.43-0ubuntu0.14.04.1) over (5.5.41-0ubuntu0.14.04.1) ...
Preparing to unpack .../libmysqlclient18_5.5.43-0ubuntu0.14.04.1_i386.deb ...
Unpacking libmysqlclient18:i386 (5.5.43-0ubuntu0.14.04.1) over (5.5.41-0ubuntu0.14.04.1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.43-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.43-0ubuntu0.14.04.1) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../libterm-readkey-perl_2.31-1_amd64.deb ...
Unpacking libterm-readkey-perl (2.31-1) ...
Selecting previously unselected package mysql-client-core-5.5.
Preparing to unpack .../mysql-client-core-5.5_5.5.43-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client-5.5_5.5.43-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.5.
Preparing to unpack .../mysql-server-core-5.5_5.5.43-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up mysql-common (5.5.43-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 250318 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.43-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
Unpacking libhtml-template-perl (2.95-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.43-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-server (5.5.43-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libmysqlclient18:i386 (5.5.43-0ubuntu0.14.04.1) ...
Setting up libmysqlclient18:amd64 (5.5.43-0ubuntu0.14.04.1) ...
Setting up libdbi-perl (1.630-1) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up libterm-readkey-perl (2.31-1) ...
Setting up mysql-client-core-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.5 (5.5.43-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.5 (5.5.43-0ubuntu0.14.04.1) ...
150516  7:40:43 [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.
150516  7:40:43 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 8654 ...
mysql start/running, process 8786
Setting up libhtml-template-perl (2.95-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-server (5.5.43-0ubuntu0.14.04.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...


oyeweb@oyeweb-Latitude-3540:/var$
oyeweb@oyeweb-Latitude-3540:/var$ sudo service mysql start
start: Job is already running: mysql
oyeweb@oyeweb-Latitude-3540:/var$
oyeweb@oyeweb-Latitude-3540:/var$ sudo service mysql status
mysql start/running, process 8786
oyeweb@oyeweb-Latitude-3540:/var$

oyeweb@oyeweb-Latitude-3540:/var$ mysql -uroot -pXXXX
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.5.43-0ubuntu0.14.04.1 (Ubuntu)


Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
24 rows in set (0.00 sec)

No comments:

Post a Comment