Troubleshooting MySQL Database on ClearDB - Deprecated

4 minute read | By Mangesh Sangapu

This article covers some common scenarios customers may run into using ClearDB with Microsoft Azure. For reference, here is a link to the ClearDB FAQ: https://www.cleardb.com/developers/help/faq As listed on the ClearDB FAQ, there are some general guidelines for using ClearDB. These guidelines include limitations on:

  • Maximum Database Connections
  • Maximum Database Size
  • Maximum SELECT Query Execution Time

* Maximum amounts vary depending on your subscription plan.


Error Message

Error establishing a database connection (displayed on web site)

PHP Warning: mysqli_real_connect(): (HY000/1226): User ‘abcdefghijk79’ has exceeded the ‘max_user_connections’ resource (current value: 4) in D:\home\site\wwwroot\wp-includes\wp-db.php on line 1454 (displayed in php_errors.log or WordPress debug.log)

Source

Web site, php_errors.log or debug.log

Solution

If you see this error in your debug.log or php_errors.log, then your application is exceeding the number of connections. If you’re hosting on ClearDB, please verify that number of connections available in your service plan.


Error Message

The management site for the database isn’t available right now. Please try again later.

Source

Microsoft Azure Dashboard > Linked Resources > Database Name

Example

Solution

The link between Azure and ClearDB may have been broken or was never linked to begin with. Email support@cleardb.com and provide the Subscription ID located within the Azure Dashboard (lower-right corner).


Error Message

Operation failed: There was an error while applying the SQL script to the database.

ERROR 1142: 1142: UPDATE command denied to user ‘name@ip’ for table ‘table_name’.

Source

MySQL Client/ DB Server Response in Application Code

Example

Solution

There are multiple reasons this may occur, but a common one is due to the subscription quota being exceeded. See the question below “How do I check the current size of my MySQL Database on ClearDB?”

If you have in-fact gone over your limit, please upgrade or read tips below on how to reduce your disk usage.


Error Message

Error Code: 1142. INSERT command denied to user ‘name@ip’ for table ‘table_name’.

Source

MySQL Client/ DB Server Response in Application Code

Example

Solution

This may also point to the subscription quota being exceeded. Read below on how to check your current size on the MySQL database.

If you have in-fact gone over your limit, please upgrade or read tips below on how to reduce your disk usage.


How do I check the current size of my MySQL database on ClearDB? There are multiple options to check your current size. One solution is through the Azure Portal and the other is to run a query on your database instance:

1) Using Azure Portal

2) Using a MySQL Client, run a query on your ClearDB Database

   SELECT
          table_schema "Data Base Name",
          sum( data\_length + index\_length ) / 1024 / 1024 "Data Base Size in MB"
   FROM
          information_schema.TABLES
   GROUP BY
          table_schema;

My ClearDB MySQL Database quota is exceeded, now what? The simplest solution is to upgrade to the recommended subscription on ClearDB, especially if you’re on the Mercury Tier. If you are still developing your app and want to remain on the free, Mercury Tier, then you will need to get rid of extra data. Use the following query to find which tables are taking up space:

   SELECT
          table_name AS "Table",
          round(((data\_length + index\_length) / 1024 / 1024), 2) MB
   FROM
          information_schema.TABLES
   WHERE
          table_schema = "**<SCHEMA/DATABASE NAME HERE>"**
   ORDER BY
          MB desc;

Where do I find my MySQL connection details?

Through the Azure Dashboard, click on “View Connection Strings”

 

This will pop-up a window with the following connection information:

  • Database (AKA Schema)
  • Data Source (Host Name)
  • UserID
  • Password

How do I connect to my MySQL Database on ClearDB?

1) Use a MySQL Client.

2) Use the PHP My Admin site extension

Step 1. Go to your website with the following URL format:   http://<sitename>.scm.azurewebsites.net

Step 2. Click “Site Extension”

Step 3. Select “Gallery”

Step 4. Find phpMyAdmin and click the plus button. Once installed, launch the extension by clicking the play button.