Back to Table of Contents

Creating MySQL database and user (All Platforms)

A run through of the command line steps required to add a new database and user for openXdata on your MySQL. A variety of graphical interfaces for MySQL exist for various platforms including MySQL Administrator and phpMyAdmin, there are a wide number of resources online to cover these programs.

Enter MySQL command line

Add a new user

mysql> CREATE USER 'myoxduser'@'localhost' IDENTIFIED BY 'securepassword';

Don't forget the ; at the end of the line. If successful, you will see:

  • Query OK, 0 rows affected (x sec)

Add a new database

mysql> CREATE DATABASE myopenxdatadb;

Don't forget the ; at the end of the line. If successful, you will see:

  • Query OK, 1 row affected (x sec)

Grant new user access to new database

mysql> GRANT ALL ON myopenxdatadb.* to 'myoxduser'@'localhost';
mysql> FLUSH PRIVILEGES;

Don't forget the ; at the end of the line. If successful, after each command you will see:

  • Query OK, 0 rows affected (x sec)

Exit MySQL

mysql> quit

To confirm your setup worked re-enter MySQL as your new user

From the command line / command prompt:
~$ mysql -u myoxduser -p
(then enter the password created in step 2)

mysql> USE myopenxdatadb;

If you get the response "Database changed" then your setup has worked