Get MySQL 5.5.12
-----------------------------------------------------------------------
$ wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.12.tar.gz
$ tar -xvzf mysql-5.5.12.tar.gz
--------------------------------------------------------------------
Change directory into mysql-5.5.12 and make && make install
------------------------------------------------------------------
$ cd mysql-5.5.12
$ apt-get install build-essential cmake libncurses5-dev libaio-dev bison
$ groupadd mysql
$ useradd -r -g mysql mysql
$ cmake . -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock
$ make
$ make install
----------------------------------------------------------------------
Chown/Chgrp and copy files
------------------------------------------------------------------------
$ cd /usr/local/mysql/
$ chown -R mysql .
$ chgrp -R mysql .
$ scripts/mysql_install_db --user=mysql
$ chown -R root .
$ chown -R mysql data
$ cp support-files/my-huge.cnf /etc/my.cnf
$ cp support-files/mysql.server /etc/init.d/mysql.server
-------------------------------
Start the service and create MySQL users
---------------------------------------------
$ /etc/init.d/mysql.server start
$ ./bin/mysql_secure_installation
$ ln -s /usr/local/mysql/bin/* /bin/
$ mysql -u root -p: CREATE USER 'user'@'server' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'user'@'server';
$ create file /etc/ld.so.conf.d/mysql.conf with contents "/usr/local/mysql/lib": ` echo "/usr/local/mysql/lib" >> /etc/ld.so.conf.d/mysql.conf`
$ run ldconfig as root
------------------------------------------------------------
Task: MySQL list databases MySQL is a simple command-line tool. MySQL is command line and it is very easy to use. Invoke it from the prompt of your command interpreter as follows:
----------------------------------
$ mysql
-----------------------------------------
output
----------------------------------------------
mysql>
---------------------------
To list database type the following command
----------------------------------------
mysql> show databases;
Output:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
------------------------------------------------------------------------------------------------
information_schema and mysql are name of databases. To use these database and to list available tables type the
following two commands:
mysql> use mysql;Output:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Now list tables:
-----------------------------------------------------------------------------------------
mysql> show tables;
Output:
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| func |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| proc |
| procs_priv |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
17 rows in set (0.00 sec)