{"id":68,"date":"2010-05-13T16:00:00","date_gmt":"2010-05-13T21:00:00","guid":{"rendered":"http:\/\/blogs.wp.stage.cpanel.net\/2010\/05\/more_details_about_db_mapping\/"},"modified":"2010-05-13T16:00:00","modified_gmt":"2010-05-13T21:00:00","slug":"more_details_about_db_mapping","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/products\/more_details_about_db_mapping\/","title":{"rendered":"More Details About DB Mapping"},"content":{"rendered":"
As mentioned in A General Overview of Database Mapping<\/em><\/a> , DB Mapping is available with the launch of cPanel 11.25.1. Let\u2019s recap what DB Mapping is and then we can chew on the details:<\/p>\n <\/p>\n Core Code<\/strong> This new functionality is, well new, and can\u2019t always be converted to an old convention. For example, account transfers benefit tremendously from DB Mapping functionality, yet are bound to coding practicalities. Products of a new, complex code base cannot be manipulated to work in an older code base; something new can only exist in the environment for which it was designed. To put it simply, DB Mapping features are not 100% backwards compatible.<\/p>\n DB Prefixing<\/strong> Mapping occurs regardless of whether Prefixing is On<\/em> or Off<\/em>. You can find the Prefix toggle in the SQL Services<\/em> section of WHM. Again, mapping is embedded in the core of cPanel which provides an easy way for cPanel admins to Opt-Out<\/em> of the Prefix paradigm. Prefixing is On<\/em> by default in 11.25.1 and the cPanel interface will continue to behave and render identical to previous versions.<\/p>\n If you turn Prefixing Off<\/em> you cannot<\/strong> turn it back on. Additionally, you will not be able to downgrade to a cPanel version that does not have DB Mapping, e.g. 11.25.0 and below. Disabling Prefixing is a one way street.<\/p>\n The mapping is stored in a YAML file in \/var\/cpanel\/databases\/<\/em> as $username.yaml<\/em>. These YAML files are system files and should be respected as such, e.g., manual manipulation is discouraged and can have unintended consequence. The files should be edited indirectly via the SQL cPanel interfaces or related API calls. If you find that database resources are not mapped as expected, cPanel Support<\/a> can help you resolve the issue.<\/p>\n Non-cPanel Transfers<\/strong> If a non-cPanel account is transferred to cPanel 11.25.1, it will utilize the DB Mapping feature set. This is great because the account is essentially mirrored in the cPanel host system. However, this also means that the migrated account is dependent on DB Mapping. Once you transfer a non-cPanel account, your system is not a candidate for downgrade. This is the same logic as disabling Prefixing: your accounts require the DB Mapping feature set.<\/p>\n For transferred accounts, the migrated account is permitted an account username up to 16 characters long, a primary database username that is different than the account username, and databases that have an arbitrary prefix**.<\/p>\n If your transferred account has an extremely long username, and you have not disabled Prefixing, you may find that there is inadequate character length for new database resources. For example, if the non-cPanel account has a name like accountlongname<\/em> and you have Prefixing On<\/em>, then all database resources will start with accountlongname_<\/em>. accountlongname_<\/em> is 16 characters long. MySQL imposes a 16-character limit on database usernames and thus the account would not be able to create database virtusers in cPanel. DB Mapping is very flexible, but ultimately must operate within the confines of the MySQL sub-system. It\u2019s a caveat, but not one that an informed administrator should be surprised by.<\/p>\n\n
\nDB Mapping is coded directly into cPanel. This includes modifications to our binary code base as well as the Perl Cpanel modules. We\u2019ve packed in more methods and dynamic code paths that allow cPanel to function in a forward-capable mode. We have chosen to use new models in our instantiated objects that expose new functionalities and at the same time can be rendered into the 11.25.0 user model.<\/p>\n
\nPrefixing database resources is a very common practice in web hosting environments. In cPanel versions prior to 11.25.1, any database resource created by a user receives a prefix, $username_<\/em>. In 11.25.1, the DB Mapping code allows the cPanel admin to turn this prefixing requirement\/implementation off. DB Mapping decouples the textual name of the resource from the account name and stores the information separately.<\/p>\n
\ncPanel strives to make account migration as seamless as possible. You can imagine how daunting a task that is when you consider the number of other web hosting environments available and the variety between them. DB Mapping abstracts cPanel accounts and database resource ownership. This allows cPanel to import any account-database relationship from a non-cPanel account and keep all attached resources intact, without any manipulation*.<\/p>\n