HOWTO Create the MySQL DB for XAMS
This article was first written in March 2004 for the BeezNest technical website (http://glasnost.beeznest.org/articles/114)
The present article has been obsoleted by the recent packages for XAMS, which already does that for you by default.
Setting up the DB for XAMS is still somewhat tricky, not because of XAMS, but because of MySQL. For this short HOWTO, we assume you are running a fresh MySQL install on Linux (Debian).
Note: Oliver Siegmar from XAMS, mentioned that, as of XAMS version 0.0.15, an easier database creation script may be found here, making this article useful only for older versions of XAMS. Please first have a look at whether you might use version 0.0.15 or higher.
The root access and user creation
As a fresh MySQL install, it is assumed that you can access your database by loging as root, then typing mysql on the command line to get into the MySQL client application as root. As specified by the MySQL documentation (up to version 5.0 beta), you create a new “xams” user (here an “all privileges” user), by typing this command in the mysql client:
GRANT ALL PRIVILEGES ON *.* TO 'xams'@'localhost' IDENTIFIED BY 'whatever_you_configure_in_xams' WITH GRANT OPTION;
The tricky thing
There’s nothing about this password trick in the documentation, but if you exit from the mysql client (usually typing exit) and try to log in again, as user ‘xams’, you won’t be asked for a password, you will be automatically granted access. Even if you access the MySQL client with the ‘-p’ option on the command line, you will never be able to reconnect to the client using the password you set (in this case ‘whatever_you_configure_in_xams’).
I think the problem is that the IDENTIFIED BY and the other method we will see shortly don’t use the same encryption method, but this is just a guess.
Anyway, to make it work, keep in root login on the system, outside the MySQL client, and type:
mysqladmin -u xams password "whatever_you_configure_in_xams"
and while you’re at it and as your MySQL is a fresh one and a root access without a password is insecure, maybe you should set the root password too:
mysqladmin -u root password "a_special_mysql_root_password"
Note that even that way, you will always be able to do this command again next time if you forget about the password. The goal here is to avoid someone to access your DB from a user account or from a remote connexion.
Setting up the xams DB
From now on, you just need to go through the xams setup manual, and do:
mysqladmin -uxams -pwhatever_you_configure_in_xams create xams mysql -uxams -pwhatever_you_configure_in_xams -Dxams < /usr/share/xams-common/sql/xams-struct.sql mysql -uxams -pwhatever_you_configure_in_xams -Dxams < /usr/share/xams-common/sql/xams.sql
To add an administrator (<admin_password> must be an md5()-ed string):
echo "INSERT INTO pm_admins(Name, Password, Locked, Added, Updated) VALUES ('xams', '198574450a043bfb6b31ddb4066cad9c', 'false', NOW(), NOW() );" | mysql -uxams -pwhatever_you_configure_in_xams -Dxams
Note: One way to get the md5-encrypted value is to go into the MySQL client and type
and then copy and paste the value on your command line.
NOW, you should be ready to use XAMS…