MySQL installation on Lubuntu

header-linux-mysql-img1

sudo apt-get install yum

Install yum if needed, but my case, eventually I didn’t, but for future reference…

To start installing, run this command:

sudo apt-get install mysql-server

350x210-img
During the installation, the root password is being asked:

sudo netstat -tap | grep mysql

After the installation, type this to prevent autostart the server
Then, showing following output:
From the leftside:
———————————————————
[protocol][local address][outer address][status]

tcp        0      0 localhost:mysql         *:*                     LISTEN      3978/mysqld

To start terminal, type this, then enter password:

$ mysql -u root -p

Terminal started:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.46-0ubuntu0.14.04.2 (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> 

Enter “status;”

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3

Connection id:		42
Current database:	
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		5.5.46-0ubuntu0.14.04.2 (Ubuntu)
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	latin1
Db     characterset:	latin1
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/var/run/mysqld/mysqld.sock
Uptime:			30 min 19 sec

Threads: 1  Questions: 582  Slow queries: 0  Opens: 189  Flush tables: 1  Open tables: 41  Queries per second avg: 0.319
--------------

Changing to UTF-8:

sudo leafpad /etc/mysql/my.cnf

Add highlighted lines:

[mysqld]
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
skip-external-locking
character-set-server=utf8
skip-character-set-client-handshake
default-storage-engine=INNODB

[mysqldump]
quick
quote-names
max_allowed_packet	= 16M
default-character-set=utf8

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition
default-character-set=utf8

Check the configuration has done correctly:
Restart and launch the terminal..

$ sudo /etc/init.d/mysql restart
...
$ mysql -u root -p

status;

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3

Connection id:		72
Current database:	
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		5.5.46-0ubuntu0.14.04.2 (Ubuntu)
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8
Db     characterset:	utf8
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/var/run/mysqld/mysqld.sock
Uptime:			48 sec

Threads: 1  Questions: 215  Slow queries: 0  Opens: 48  Flush tables: 1  Open tables: 41  Queries per second avg: 4.479
--------------

Config has changed it to UTF8 (highlighted lines)
Reference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.