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:

The solution was to run these sql’s at the Mysql database:

This issue seems to be related to: https://tracker.moodle.org/browse/MDL-43147 https://moodle.org/mod/forum/discuss.php?d=217512 https://tracker.moodle.org/browse/MDL-37016

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:

If you don’t like to scroll: -bash-3.2$ mysql -h your.server.edu -u db_username -pcat /path/to/your/homedir/secretpasswordfile -e “use databasename; SELECT tablename.columnname FROM tablename where id like ‘421111’ and […]

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 # […]