Using MySQL: Difference between revisions

From ULYSSIS documentation
No edit summary
No edit summary
Line 17: Line 17:


==Managing MySQL with PHPMyAdmin==
==Managing MySQL with PHPMyAdmin==
Using your username and password you can easily manage your MySQL databases, tables and records on [https://phpmyadmin.ulyssis.org]
Using your username and password you can easily manage your MySQL databases, tables and records on https://phpmyadmin.ulyssis.org


==Accessing MySQL from outside of our network==
==Accessing MySQL from outside of our network==
To prevent unnecessary load on our database server by hackers and bots it is only available inside of our network. If you wish to access it externally the easiest way is to use an SSH-tunnel. In many mysql management tools this is already supported. On Linux, Mac OSX and other Unix-like Operating Systems it is also easily possible to use the following command to create a tunnel to a local port (in this case 3300)
To prevent unnecessary load on our database server by hackers and bots it is only available inside of our network. If you wish to access it externally the easiest way is to use an SSH-tunnel. In many mysql management tools this is already supported. On Linux, Mac OSX and other Unix-like Operating Systems it is also easily possible to use the following command to create a tunnel to a local port (in this case 3300)
  ssh -f username@ssh2.ulyssis.org -L 3300:mysql.ulyssis.org:3306 -N
  ssh -f username@ssh2.ulyssis.org -L 3300:mysql.ulyssis.org:3306 -N

Revision as of 01:17, 11 May 2014

Creating a MySQL user

To use MySQL on your ULYSSIS account you first need to create a MySQL user on [1]. In the MySQL section of the panel you will be suggested to click a link to create a user. Then fill in a password for the database user. It is highly recommended that this password differs from the password you use for your account. Then you just click Create user and you are ready to go.

Creating a MySQL database

After creating a MySQL user, you can simple press Add database in [2] and enter the name for your new database. It will automatically be prefixed by your username.

Using MySQL for your website or application

Host: mysql.ulyssis.org
Username: your account's username
Password: the password you chose when you made the MySQL user
Database: the database name you chose, prefixed by your username

For example, if my username is foobar, I made a database called website and I were to create a PHP website I would use something like:

$db = new mysqli('mysql.ulyssis.org', 'foobar', 'correct horse battery staple', 'foobar_website');

or

$db = new PDO('mysql:host=mysql.ulyssis.org;dbname=foobar_website', 'foobar', 'correct horse battery staple');

Managing MySQL with PHPMyAdmin

Using your username and password you can easily manage your MySQL databases, tables and records on https://phpmyadmin.ulyssis.org

Accessing MySQL from outside of our network

To prevent unnecessary load on our database server by hackers and bots it is only available inside of our network. If you wish to access it externally the easiest way is to use an SSH-tunnel. In many mysql management tools this is already supported. On Linux, Mac OSX and other Unix-like Operating Systems it is also easily possible to use the following command to create a tunnel to a local port (in this case 3300)

ssh -f username@ssh2.ulyssis.org -L 3300:mysql.ulyssis.org:3306 -N