-
Notifications
You must be signed in to change notification settings - Fork 11
MySQL MariaDB Database Creation
Wiki ▸ MySQL/MariaDB Database Creation
Welcome to the slimpd wiki!
###MySQL/MariaDB DATABASE CREATION###
-
In this section MySQL and MariaDB will be used interchangeably to describe the same database setup. "For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version" MariaDB is the recommended choice for installation. "It’s made by the original developers of MySQL and guaranteed to stay open source." MariaDB uses much of the same MySQL code and language _(for example, the line of code below to initialize the server uses
"mysql"install_db...
This language does not change regardless of which server you are using. "mysql" is the default name used in code whether you are using MySQL or MariaDB). -
Install MySQL/MariaDB and initialize the server. As superuser run (check your distributions instructions, they may vary):
$ mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
-
Now the MySQL or MariaDB service may be started and/or enabled (systemctl or init-scripts). As superuser run the following command to secure your installation (follow the prompts. Remember there is no 'password' connected to the installation at this point):
<code>$ mysql_secure_installation</code>
-
Configuration options are read from the following files in the given order:
'/etc/my.cnf' '/etc/mysql/my.cnf' '~/.my.cnf'
. -
Create the MySQL user and password, we'll call our user 'slimpduser' and password 'mypassword'. And create the MySQL database, we'll call it 'slimpddb'. Select your 'hostname'. 'Hostname' tells MySQL what hosts the user can connect from. If you only want it from the same machine you are on/using, use 'localhost'.
-
First start MySQL in terminal at the command prompt:
$ mysql -u user -p
-
User is the default admin user name that you created during initialization (probably 'root'), and the
'-p'
will ask you for your password after you hit 'enter'. After correctly entering the password you are in the MySQL/MariaDB shell ('mysql>' or 'MariaDB>'). Next create your sliMpd user, password, and database:
-
MariaDB> CREATE USER 'slimpduser'@'localhost' IDENTIFIED BY 'mypassword';
MariaDB> CREATE DATABASE `slimpddb`;
MariaDB> GRANT ALL PRIVILEGES ON `slimpddb`.* TO 'slimpduser'@'localhost';
MariaDB> FLUSH PRIVILEGES;
MariaDB> quit
-
Create database tables and begin the import of your music from your Mpd-database:
$ php ./slimpd hard-reset