MySQL client for Lubuntu

header-linux-mysql-img1
MySQL Workbench is official and most widely known GUI client for MySQL. Here is how I installed.

$ sudo apt-get install mysql-workbench

Check the installation completed:

$ /usr/bin/mysql-workbench --help

To create launcher:

$ sudo leafpad .local/share/applications/mysql-workbench-bin.desktop

Add the following to .desktop file

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=MySQL Workbench
Icon=mysql-workbench-bin
Exec=/usr/bin/mysql-workbench
StartupNotify=false
StartupWMClass=Mysql-workbench-bin
OnlyShowIn=Unity;
X-UnityGenerated=true

Launch MySQL workbench:
mysql-install-img1
1. Click plus sign right next to “My SQL Connection”
2. Enter “localhost” after Connection Name, hit “Test Connection” enter password


Adding a user:
Start the program and launch the terminal:

sudo /etc/init.d/mysql start
mysql -u root -p

Type following to define a user and its password:

GRANT ALL PRIVILEGES ON *.* TO (name)@localhost IDENTIFIED BY '(password)' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Login as a new ID:

mysql -u (name) -p
Enter password: *****

2. Heidi SQL
I prefer Heidi SQL over SQL workbench because this is more user friendly. Since this has no Linux version, I have to use it over Wine.

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