There are requirements at times where we have to execute the queries on the Prod database which changes the data in the table i.e insert & update queries. While inserting could be a straightforward case as the number of record is known same can't be said for UPDATE queries as the number of effected rows … Continue reading Using Python to execute MySQL Insert and Update queries
MySQL
MySQL
Difference between two dates in mysql
You can use MySQL's inbuilt function TIMESTAMPDIFF to get difference between two dates in MySQL. A typical query would be
partial table dump using mysqldump
There are times when you only want to take partial dump of a mysql table. You can use mysqldump command with one extra option "--where". You will have to provide your where clause (partial dump condition) in the "--" where option. Below is the command to take a partial dump of a table. Related Posts: … Continue reading partial table dump using mysqldump
Mysql Dump in XML format
To take dump in XML format you have to provide an extra option in default mysqldump command. This can be useful in cases where you want to migrate your MySQL database to some other database. You can use below command to take MySQL Database dump in XML format. or For example if you have a database … Continue reading Mysql Dump in XML format
MySQL General query logs
MySQL prints each query in General query logs. This can be helpful in application profiling if you want to see how many and which queries are being run in a transaction and when commit/rollback is executed. You can enable MySQL general query logs by running below sql command from root user: By default, logs will be stored at /var/log/query.log … Continue reading MySQL General query logs
Increase MySQL maximum connection limit
MySQL’s default configuration sets the maximum concurrent connections to 151. If you get a too many connections error when you are trying to connect to MySQL server, this means that all available connections are in use by other clients / Users. The number of connections permitted is controlled by the max_connections system variable. Its default value … Continue reading Increase MySQL maximum connection limit
MySQL query with the conditions as ‘NOT LIKE IN’
While working with MySQL database i needed to write a query which will exclude rows where a column contains one or more words from a set of words. i.e I want to fetch data from student from table where name doesn't contain words shashank,john etc. Initially i was trying to write a query like this : … Continue reading MySQL query with the conditions as ‘NOT LIKE IN’