| Debian, MariaDB, Perl and DBD::mysql |
| Downloading the Test Program |
| See Also |
Help (https://mariadb.com/kb/en/how-can-i-upgrade-from-mysql-to-mariadb/#comment_960)
Help (http://sqlrelay.sourceforge.net/sqlrelay/gettingstarted/mysql.html)
All this as root:
gpg --keyserver keys.gnupg.net --recv-keys CBCB082A1BB943DB
gpg -a --export CBCB082A1BB943DB | apt-key add -
Warning: The next line originally used 'squeeze', not 'wheezy':
echo "deb http://mirror2.hs-esslingen.de/mariadb/repo/5.5/debian wheezy main" >> /etc/apt/sources.list
sudo apt-get update
Warning: The next line originally lacked 'libmariadbclient-dev', which contains 'mysql_config', which is needed by DBD::mysql:
sudo apt-get install mariadb-client mariadb-server mariadb-client-5.5 mariadb-server-5.5 mariadb-server-core-5.5 mariadb-client-core-5.5 libmariadbclient-dev
Change root password:
mysql -uroot -e "update user set password=password('newpassword') where user='root'" mysql
mysqladmin -uroot reload
Create a database:
mysqladmin -uroot -pnewpassword create testdb --default-character-set=utf8
Create a user and give them access to that database:
mysql -uroot -pnewpassword mysql
Note: The next line originally used 'testpassword'. I use 'testpass':
insert into user (host,user,password) values ('localhost','testuser',password('testpass'));
insert into user (host,user,password) values ('%','testuser',password('testpass'));
Warning: The next line originally had 17 Ys, and now needs 19 Ys (for MySQL V 5.5.35):
insert into db values ('%','testdb','testuser','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
mysqladmin -uroot -pnewpassword reload
Now I can do:
mysql -utestuser -ptestpass testdb
and (at the 'MariaDB [testdb]' prompt):
show global variables like "version";
\q
Now try, and fail, to install DBD::mysql:
DBI_USER=ron
export DBI_USER
DBI_PASS=savage
export DBI_PASS
DBI_DSN=dbi:mysql:testdb
export DBI_DSN
cpanm DBD::mysql
But this does not work because it defaults to the user logged in to the bash shell. So:
So do this instead:
Download DBD-mysql-4.026.tgz, untar it and cd into the dir
Note: The next line does not use 'sudo make install' because I'm running perlbrew:
perl Makefile.PL --testuser=testuser --testpassword=testpass --testdb=testdb; make; make test; make install
Works with MySQL, Postgres and SQLite: dbd.utf8.pl
The output shows that all 3 database servers just Do The Right thing without the user having to call encode()/decode().