This section describes how to set up a training database using MySQL. The database can be on a Windows or Linux machine and can be on a different machine to your Media Server.
To set up a MySQL database
Download and install a MySQL server. Ensure that the package includes the mysql
command-line tool. During installation, set up a user account with superuser privileges. The MySQL server is typically installed to run as a service. For detailed instructions, refer to the MySQL documentation.
Configure the database server for use with Media Server:
my.ini
on Windows, or /etc/my.cnf
on Linux.max_allowed_packet=1073741824
.(Windows only) Add the MySQL bin
directory to your PATH
environment variable. This step enables you to use the command mysql
to start the mysql
command-line tool from the Windows Command Prompt. If you do not add the directory to the PATH
environment variable, you must specify the full path of the tool. This step is usually not required on Linux because the tool is installed to a directory such as /usr/bin
, which is already in the PATH
.
Create a new database to store Media Server training data.
Open a command-prompt or terminal and start the mysql
command line tool:
mysql -u user -p
where user
is your MySQL user name.
Run a CREATE DATABASE
command to create a new database. Specify the following database settings.
Database name | Any name. |
Character set | Must be Unicode–either UTF8 or UCS2. |
Collation | Any that is compatible with the encoding. |
For example:
CREATE DATABASE MediaTraining CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Close the mysql
command-line tool:
quit
Set up the database schema that Media Server requires. To do this, run the my.sql
script provided in the sql
folder of the Media Server installation directory.
sql
folder of the Media Server installation directory (for example, C:\MediaServer\sql
on Windows or /opt/MediaServer/sql
on Linux). This is important because the my.sql
script refers to other files in the same directory.Run the my.sql
script. Running the script non-interactively from the terminal ensures that the script terminates if an error occurs. For example:
mysql -u user -p -v -D MediaTraining < my.sql
where user
is your MySQL user name, and MediaTraining
is the name of the database you created.
Create a user for Media Server to use and grant the following privileges to that user:
Grant... | On... |
---|---|
Create Temporary Tables | Database |
Select, Insert, Update, Delete | All tables |
Execute | All functions and stored procedures |
Start the mysql
command-line tool:
mysql -u user -p
Create a new user:
CREATE USER 'MediaServer' IDENTIFIED BY 'password';
where MediaServer
is the name of the new user, and password
is the password for the new user.
Grant the necessary privileges to the new user:
GRANT CREATE TEMPORARY TABLES ON MediaTraining.* TO 'MediaServer'; GRANT SELECT, INSERT, UPDATE, DELETE ON MediaTraining.* TO 'MediaServer'; GRANT EXECUTE ON MediaTraining.* TO 'MediaServer';
where MediaTraining
is the name of the database you created and MediaServer
is the name of the user you created for Media Server.
Close the mysql
command-line tool:
quit
You can now set up a data source name (DSN) so that Media Server can connect to the database. If you are running Media Server on Windows, see Create a MySQL DSN on Windows. If you are running Media Server on Linux, see Create a MySQL DSN on Linux.
|