back home

Database Server using Ubuntu 17.04

October 24, 2017

0. Update system

$ apt-get update
$ apt-get upgrade

# Set Timezone - Jakarta
$ dpkg-reconfigure tzdata

1. Install MySQL Database Server

$ apt-get install mysql-server

2. Replace Bind-address

# Edit file /etc/mysql/mysql.conf.d/mysqld.cnf
# Replace
bind-address        =

# To be:
bind-address        =

Check before restart

[email protected]:~# lsof -i -P | grep :3306
mysqld    21131           mysql   20u  IPv4  37990      0t0  TCP localhost:3306 (LISTEN)

Check after restart

[email protected]:~# service mysql restart
[email protected]:~# lsof -i -P | grep :3306
mysqld    21282           mysql   28u  IPv4  39462      0t0  TCP *:3306 (LISTEN)

3. Create User

$ mysql -u root -p

and enter your password

mysql> CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
mysql> CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
mysql> GRANT ALL ON *.* TO 'myuser'@'localhost';
mysql> GRANT ALL ON *.* TO 'myuser'@'%';

Flush and exit

mysql> EXIT;

4. Delete Development Environment

$ mysql_secure_installation

Enter your root password

Change the password for root? — no
Remove anonymous users? — yes
Disallow root login remotely? — yes
Remove test database and access to it? — yes
Reload privilege tables now? — yes

All done!

you can use Sequel Pro for Database Management