Setup Database Server using Ubuntu 17.04
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 127.0.0.1
bind-address = 127.0.0.1
# To be:
bind-address = 0.0.0.0
Check before restart
root@DatabaseProd:~# lsof -i -P | grep :3306
mysqld 21131 mysql 20u IPv4 37990 0t0 TCP localhost:3306 (LISTEN)
Check after restart
root@DatabaseProd:~# service mysql restart
root@DatabaseProd:~# 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> FLUSH PRIVILEGES;
mysql> EXIT;
4. Delete Development Environment
$ mysql_secure_installation
Enter your root password VALIDATE PASSWORD plugin? -- no
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