drop database if exists mo_development;
create database mo_development;
drop database if exists mo_test;
create database mo_test;
drop database if exists mo_tmp;
create database mo_tmp;
use mo_tmp;

drop procedure if exists createUser;
delimiter $$
create procedure createUser(username varchar(50), pw varchar(50))
begin
IF (SELECT EXISTS(SELECT 1 FROM `mysql`.`user` WHERE `user` = username)) = 0 THEN
    begin
    set @sql = CONCAT('CREATE USER ', username, '@\'localhost\' IDENTIFIED BY \'', pw, '\'');
    prepare stmt from @sql;
    execute stmt;
    deallocate prepare stmt;
    end;
END IF;
end $$
delimiter ;

call createUser('mo', 'mo');
use mo_test;
drop database mo_tmp;

grant all privileges on mo_development.* to 'mo'@'localhost' with grant option;
grant all privileges on mo_test.* to 'mo'@'localhost' with grant option;

drop database if exists mo_development;
create database mo_development
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;
drop database if exists mo_test;
create database mo_test
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;
drop database if exists mo_tmp;
create database mo_tmp;
use mo_tmp;

drop procedure if exists createUser;
delimiter $$
create procedure createUser(username varchar(50), pw varchar(50))
begin
IF (SELECT EXISTS(SELECT 1 FROM `mysql`.`user` WHERE `user` = username)) = 0 THEN
    begin
    set @sql = CONCAT('CREATE USER ', username, '@\'localhost\' IDENTIFIED BY \'', pw, '\'');
    prepare stmt from @sql;
    execute stmt;
    deallocate prepare stmt;
    end;
END IF;
end $$
delimiter ;

call createUser('mo', 'mo');
use mo_test;
drop database mo_tmp;

grant all privileges on mo_development.* to 'mo'@'localhost' with grant option;
grant all privileges on mo_test.* to 'mo'@'localhost' with grant option;

Set db default collation & charset
Set db default collation & charset

Hopefully this will fix Travis errors which occur when loading fixtures, like
```ruby
ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\xCE\x95\xCE\xBB\xCE\xBB...' for column 'name' at row 1: INSERT INTO `languages` (`locale`, `name`, `order`, `official`, `beta`, `id`) VALUES ('el', 'Ελληνικά', 'Ellenika', 0, 1, 552606384)
```
