mysql allow invalid dates on select mysql allow invalid dates on select sql sql

mysql allow invalid dates on select

This is what I do to ignore invalid dates:


  • Log into mysql in the command line mysql -u root -p
  • Enter your password
  • View the current sql-modes using SELECT @@GLOBAL.sql_mode;
  • Copy the current modes (add or delete modes as needed) and paste in next step.
  • This adds ALLOW_INVALID_DATES and removes both NO_ZERO_DATE, NO_ZERO_IN_DATE
  • Restart the MySQL server /etc/init.d/mysql start

SQL Server Modes [Reset configuration file]

Solution Link
- From the command line which mysqld
- Should get something like /usr/sbin/mysqld which is the location of the binary file
- Sort out the path for the configuration files /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
- Your bash response should look like this: Default options are read from the following files in the given order:/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
- Look at the files in successive order to see where to make changes (if a file does not exist it is not being referenced).
- Look up your current mode. Open a terminal and log into the mysql database mysql -u database_user -p -e "select @@sql_mode"
- Modify the SQL modes you want to change by adding the following code to the configuration file.

- Save the configuration file and restart the mysql service