skip to primary navigationskip to content
 

MySQL

MySQL (v 5.5.47) is installed by default. On a new server you have access to a single user called 'root'. This user has a random password assigned to it which you can access or change from the panel ('Server Settings --> 'Change database root password'). MySQL can only be accessed from localhost. You should use the root MySQL user to create other MySQL users to control the databases you create for your application and content management systems.

The MWS does not provide graphical tools such as PHPMyAdmin, though you could install this yourself.

MySQL backups are stored in /snapshots/mws-snapshot-<year>-<month>-<day>/mysqldumps

If you forget your MySQL root password or you lock yourself out of MySQL, you can use the "Change database root password option" in the Control Panel.

The database has an additional user called 'debian-sys-maint'. This is used for routine database activities such as making database backus. Please do not delete or reconfigure this user.

If you have exported a database on the old MWS and import it into MySQL in your new MWS site, you should run the command

$ mysql_upgrade --force -u root -p

to update the database you have just imported. This is because the old MWS runs version 5.1 of MySQL and the database will need to be updated to work correctly in the MySQL on the new MWS.

When exporting databases on the old MWS, export (in sql format, not binary) the individual databases used by your website and not all databases at once (if using mysqldump to export databases, do not use the "--all-databases" option). Importing all databases can overwrite the existing user table in MySQL on your new site.

The MySQL database on your MWS server is only directly accessible from that server. It listens on the normal Unix domain socket and on the TCP port localhost:3306. The TCP port can be used to establish an SSH tunnel, allowing administrators and ssh-only users to connect remotely to the site's MySQL server. For example after running

$ ssh mws-12345.mws3.csx.cam.ac.uk -L 3307:127.0.0.1:3306

the database port on the MWS site mws-12345.mws3.csx.cam.ac.uk will appear as port 3307 on the local machine and

$ mysql -h 127.0.0.1 -P 3307

will correctly connect to the MWS site database. You will probably need to supply a username and password before such a connection will actually succeed.