Table of Contents MariaDB is the version of the MySQL database server developed by the company founded by Michael Widenius, the originator of MySQL. You can do everything with MariaDB that you can do with MySQL. If the truth be told, you can do a whole lot more—because you won't be working in the shadow of Larry Ellison.
This article addresses a very specific issue—the installation of the
binary version of the MariaDB database server on Ubuntu 10.10. There is
no
To obtain the Linux binaries for use with Ubuntu 10.10, navigate to
http://askmonty.org/wiki/MariaDB:Download and find
the generic binary file suitable for your architecture. The file you
want bears the name Download this file and decompress it by entering the following commands: shell> cd
This creates a directory with the name
A shell> sudo groupadd mysql shell> sudo useradd -g mysql mysql
These commands create a group called
For easiest installation the MariaDB binaries need to be installed
below the shell> cd
Because the directory name is so unwieldy, create a link to it so
that we can reference
shell> cd /usr/local
shell> sudo ln -s
Now ... drwxr-xr-x 12 peter peter 4096 2010-11-11 09:26 mariadb-
The line indicating the linked directory begins with an ' shell> cd mysql shell> sudo chown mysql ./ -R shell> sudo chgrp mysql ./ -R With ownership changed, the installation script can be executed. shell> sudo scripts/mysql_install_db --user=mysql
Executing this script creates a directory named You should now check that the MariaDB server works by starting it up using the command sudo ./bin/mysqld_safe &. Confirm that it has started by connecting to the MariaDB server using the mysql client command: shell> ./bin/mysql If you connect to the server, you should see output such as the following: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.1.50-MariaDB (MariaDB - http://MariaDB.com/) This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [none]>
Quit the client by entering At this point you've installed the database server and confirmed that it runs. At the very least you will want the database server to start up automatically and to add the MariaDB binaries to your PATH variable. This section covers those tasks.
The MariaDB executables are found in the
To avoid doing this alter the PATH=$PATH:/usr/local/mysql/bin: export PATH Note
Files that begin with a '
The next time you open a terminal window execute echo $PATH and confirm that
Note
The many MySQL command line programs such as mysqldump and mysqladmin are also found in
You probably want to start MariaDB automatically whenever your
machine boots up. If you look at the
To start MariaDB on reboot you need to create an initialization
script in the
Here are the commands you need to copy shell> cd /usr/local/mysql/support-files shell> sudo cp mysql.server /etc/init.d/mysql shell> sudo chmod +x /etc/init.d/mysql Next use the update-rc.d command to create the proper symlinks for the different run levels. Do this in the following way: shell> sudo update-rc.d mysql defaults If you are successful, you should see output like the following: Adding system startup for /etc/init.d/mysql ... /etc/rc0.d/K20mysql -> ../init.d/mysql /etc/rc1.d/K20mysql -> ../init.d/mysql /etc/rc6.d/K20mysql -> ../init.d/mysql /etc/rc2.d/S20mysql -> ../init.d/mysql /etc/rc3.d/S20mysql -> ../init.d/mysql /etc/rc4.d/S20mysql -> ../init.d/mysql /etc/rc5.d/S20mysql -> ../init.d/mysql
You can test that MariaDB starts automatically by rebooting and
then running the client program, At this point the MariaDB server will start automatically on reboot but you still need to install the GRANT tables. To do this run the /usr/local/mysql/bin/mysql_secure_installation script with root privileges. This script requires interaction from the user. The script first asks for root's password. Note that this is the root password for the database server not the operating system password. Currently there is no password for root so just press the enter key. You will then be asked whether you wish to give the root user a password. Since this is not a production server security considerations aren't paramount but giving the root user a password is a good idea. Make sure that you make note of this password. Allow remote access as you see fit. However, do remove the anonymous user—in some circumstances the existence of this user is not only insecure but confusing. After running this script you'll find that you can no longer connect to the server by simply entering the command mysql. Try it and you should see output similar to the following:
ERROR 1045 (28000): Access denied for user '
You'll have to specify a username and password. Start up the database client by entering: mysql --user root --password. If you created a password for the root user, enter it when prompted. Once you're logged in enter the following commands. MariaDB [(none)]> CREATE USER '
Note that you must have quotation marks around the username, the
'
You can avoid typing startup parameters by adding a configuration
file called
Using your favourite text editor, create a file named #This section applies to all clients [client] user=
You can now start the client programme by simply typing
Peter Lavin is a technical writer who has been published in a number of print and online magazines. He is also the author of Object Oriented PHP, published by No Starch Press. Please do not reproduce this article in whole or part, in any form, without obtaining written permission. |
||
|
||