Search Engine: Elastic

Article ID: 2499, created on Oct 29, 2007, last review on May 8, 2014

  • Applies to:
  • Pro Control Panel Linux


View Knowledge
Knowledge ID 1274
Product : WEBppliance for Linux
Version : 3.5.0
Topic : FAQ

How to create MySQL databases without using WEBppliance PRO

How to create MySQL databases without using WEBppliance PRO


 WEBppliance PRO introduced the ability for sites hosted on the appliance to have multiple MySQL databases that could be created, renamed, and deleted by the site administrators. Additionally, these databases are created within the site filesystems, allowing their usage to be tracked against disk quota.

    While it is reasonably simple to create a new database as a site administrator, experienced appliance administrators or root users will find that they can no longer simply create databases through the standard MySQL tools. This loss of functionality occurs because the /var/lib/mysql directory is now owned by the user root, and the directory only has write permission for the root user. The MySQL daemon runs as the user mysql, and thus can't write to this directory when it tries to create a database. The rationale behind this change is that by using the WEBppliance PRO GUI to create databases, the software can ensure that the databases are created in such a way that they will be tracked against a site's disk quota. WEBppliance PRO has no way to easily identify and setup properly databases created through the standard MySQL utilities prior to the databases possibly being used. In particular, if the /var/lib/mysql directory was owned by the mysql user, as it is in a standard installation, a site administrator could drop and then recreate his or her database via the standard MySQL utilities, and it may be recreated in such a way that it would not fall under the site's disk quota.

    If the appliance administrator or root user does need to create a database outside a domain, these are the steps that should be followed (assume for this example that the desired database is to be called my_database):

1. Login to the system as root.
2. mkdir /var/lib/mysql/my_database
3. chown mysql.mysql /var/lib/mysql/my_database
4. /etc/rc.d/init.d/mysqld restart

    After these three steps, the database may be manipulated as normal, except that it may not be dropped. To remove the database, please follow these steps (once again, assume the database is named my_database):

1. Login to the system as root.
2. rm -f /var/lib/mysql/my_database/*
3. rmdir /var/lib/mysql/my_database
4. /etc/rc.d/init.d/mysqld restart

    The restart of mysqld is required to sync mysql's internal database cache with the actual state of the filesytem.



Related Knowledge

Related Links
Last ModifiedUsageSatisfiedLast Used
8/20/2004 12:51:18 PM133 10/11/2007 6:31:09 AM

4cc899da08664637a8bc437308d3ddd7 3ccb419cf98083f3bb45808fba8dbc7c 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF