Skip to main content

Posts

Showing posts from April, 2017

[mysql] mysql 5.7 - How to Permanently Change SQL Mode in MySQL

Open the configuration file ( /etc/mysql/my.cnf ) and add the following line into the   [mysqld] section: [mysqld] # ... other stuff will probably be here sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" Save, exit, and restart MySQL: sudo service mysql restart VoilĂ , the SQL mode is permanently changed and I can continue developing the legacy project until I need some additional strictness.

[mysql] grant user to a db

INSERT INTO `db` VALUES ('localhost','db','user','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); INSERT INTO `user` VALUES('localhost','user','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0, 'mysql_native_password',password('password'),'N', now(),NULL,'N'); flush privileges;