It’s true, that is a lot of databases.
Tag Archives: mysql
Database Programming – An Intermediate MySQL Tutorial – Scripting, Data Types, Examples
I found this great collection of notes: Database Programming – An Intermediate MySQL Tutorial – Scripting, Data Types, Examples.
Prepared statement needs to be re-prepared
I have seen this error before, Prepared statement needs to be re-prepared, I’m not sure if I will see it again, but just in case I’m keeping this link…
MySQL admin with Ian Gilfillan
I was doing some reading today and I came upon an old series of articles over on www.databasejournal.com by a dude called Ian Gilfillan:
- MySQL backups
- Database Replication in MySQL
- Restoring lost data from the Binary Update Log
- Optimizing MySQL: Queries and Indexes
- Optimizing MySQL: Hardware and the Mysqld Variables
- MySQL’s Query Cache
- MySQL’s Over-looked and Under-worked Slow Query Log
For the ‘type’ in SQL ‘EXPLAIN’ Ian says: from best to worst the types are: system, const, eq_ref, ref, range, index, all.
It seems this Ian Gilfillan fellow has been rather prolific.
MariaDB Sequences
Today I discovered sequences in MariaDB. Gonna take them for a spin!
watch catting together HTML head/foot and MySQL information_schema.processlist
This came up back on August 9th 2020 in #lobsters on freenode. They were doing a system upgrade and providing a report by using `watch` to `cat` together a HTML header and footer with `mysql -e ‘select * from information_schema.processlist’` to provide a status report. Thought that was a neat hack.
How to generate an SSL private key for use with MySQL/MariaDB and PDO
To generate an SSL private key for use with MySQL/MariaDB and PDO:
openssl genrsa -out client-key.pem 4096
MySQL Table Locking Issues
Today reading about MySQL Table Locking Issues. Of particular interest were the HIGH_PRIORITY and SQL_BUFFER_RESULT SELECT Statement options.
Omitting date completed from MySQL dump file
By default when you run a dump with ‘mysqldump’ the date of the dump is appended to the file, e.g.:
jj5@love:~/desktop/experiment$ udiff * --- dbt__jj_dev_1__svn_jdrepo.1.sql 2019-06-11 18:11:13.267758230 +1000 +++ dbt__jj_dev_1__svn_jdrepo.2.sql 2019-06-11 18:12:03.856075974 +1000 @@ -32,4 +32,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-06-10 21:59:44 +-- Dump completed on 2019-06-10 12:06:49
This causes dumps for a single database that has not changed to have two dumps which differ. It’s better to have dumps from the same unchanged database to be the same. To facilitate that add the –skip-dump-date option when running ‘mysqldump’.
See here for the back-story.
PDO: Execute a prepared statement using array for IN clause
See Example #5 here.
/* Execute a prepared statement using an array of values for an IN clause */ $params = array(1, 21, 63, 171); /* Create a string for the parameter placeholders filled to the number of params */ $place_holders = implode(',', array_fill(0, count($params), '?')); /* This prepares the statement with enough unnamed placeholders for every value in our $params array. The values of the $params array are then bound to the placeholders in the prepared statement when the statement is executed. This is not the same thing as using PDOStatement::bindParam() since this requires a reference to the variable. PDOStatement::execute() only binds by value instead. */ $sth = $dbh->prepare("SELECT id, name FROM contacts WHERE id IN ($place_holders)"); $sth->execute($params);