Database

MySQL Database

What is MySQL?

MySQL is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL). MySQL is a popular choice for web applications and is used by many high-profile websites, including Facebook, Twitter, and YouTube.

MySQL


Remote Access

Edit the MySQL configuration file to allow remote access to the database server.

> sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Modify the bind-address to 0.0.0.0 to allow connections from any IP address.

# If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir                = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 0.0.0.0

Save the file and restart the MySQL service to apply the changes.

> sudo systemctl restart mysql

Grant root access to MySQL from any host.

> mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
mysql> UPDATE mysql.user SET host='%' WHERE user='root';
mysql> FLUSH PRIVILEGES;
Previous
Chroma