MySQL can be installed as simple as below.

$sudo apt install mysql-server

mysqld.conf

$sudo vi /etc/mysql/my.cnf (<- dev server uses this )
$sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf  [16.04 | 18.04 | 20.04 | 22.04]
#bind-address            = 127.0.0.1 (comment out will allow to listen all IP)
max_allowed_packet      = 256M

server-id               = 1
log_bin                       = /var/log/mysql/mysql-bin.log (enable binary log)
sql_mode = (adding this line disables MySQL Strick Mode) 

sql_mode can be changed with query as well

SELECT @@sql_mode 
-- SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
$sudo vi /etc/mysql/conf.d/mysqldump.cnf
        max_allowed_packet      = 256M
$sudo /etc/init.d/mysql restart

Root account setting

$sudo mysql -u root
mysql>SET GLOBAL validate_password.policy=LOW;

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

After this, it will be easier to add other users and grant privileges with GUI of MySQL Workbench.

Leave a Reply

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