Mysql

Mysql / Mariadb performance test

Posted on

I have two different Linux servers, and wanted to test if one where faster than the other. I used mysqlslap together with the “time” command in a bash shell. # time mysqlslap –user=root –password=$(cat /root/mysql) –host=localhost concurrency=50 –iterations=100 –number-int-cols=5 –number-char-cols=20 –auto-generate-sql –verbose In this way I could get out different values from the server which […]

Moodle

Upgrade Moodle 2.2.1 to 2.6.2+

Posted on

I tried to upgrade Moodle 2.2.1 to 2.6.2+ and got this error message: Default exception handler: DDL sql execution error Debug: Data truncated for column ‘institution’ at row 999 ALTER TABLE mdl_user MODIFY COLUMN institution VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ” after phone2 Error code: ddlexecuteerror The solution was to run […]

bash

Mysql SQL in bash one-liner

Posted on

If you just need a quick way to get some data from a mysql database in your shell (bash), you could do something like this in one line: mysql -h your.server.edu -u db_username -p`cat /path/to/your/homedir/secretpasswordfile` -e “;use databasename; SELECT tablename.columnname FROM tablename where id like ‘421111’ and something like ‘1’ and option like ’23’;”; > […]

bash

Finding spam users

Posted on

We had a lot of spam users in our multisite wordpress system. This was because we had self-registration enabled for a period. Not a smart thing to do… anyway, I wrote a bash script in order to find which users id’s from the Mysql database that could potentially be spam users. With this list of […]

Mail

Alert Blog Admin php script

Posted on

I had to send emails to all the Blog admins in our WordPress Multisite installation. This is how I did it: [code lang=”php”] <?php # Alert Blog Admin php script # connect to blog db, select from, find all blog admin email adresses # get subject, body from pre-created local files, send the email # […]