• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

How to Fix MySQL Error 1285 – SQLSTATE: HY000 (ER_WARN_HOSTNAME_WONT_WORK) MySQL is started in –skip-name-resolve mode; you must restart it without this switch for this grant to work

December 20, 2023

How to Fix MySQL Error 1285 – SQLSTATE: HY000 (ER_WARN_HOSTNAME_WONT_WORK)

MySQL is a popular open-source relational database management system used by many websites and applications. However, sometimes users may encounter errors while working with MySQL. One such error is MySQL Error 1285 – SQLSTATE: HY000 (ER_WARN_HOSTNAME_WONT_WORK). This error occurs when MySQL is started in –skip-name-resolve mode, and you try to grant privileges to a user based on their hostname. In this article, we will explore the causes of this error and provide step-by-step instructions on how to fix it.

Causes of MySQL Error 1285

The main cause of MySQL Error 1285 is the –skip-name-resolve mode. When MySQL is started with this mode enabled, it disables the hostname resolution for incoming connections. This means that MySQL will not perform any DNS lookups to resolve the hostname of the connecting clients. As a result, when you try to grant privileges to a user based on their hostname, MySQL throws the ER_WARN_HOSTNAME_WONT_WORK error.

Fixing MySQL Error 1285

To fix MySQL Error 1285, you need to restart MySQL without the –skip-name-resolve switch. Follow the steps below to resolve the issue:

Step 1: Stop the MySQL Service

Before making any changes, stop the MySQL service to ensure a clean restart. You can use the following command to stop the MySQL service:

sudo service mysql stop

Step 2: Edit the MySQL Configuration File

Next, you need to edit the MySQL configuration file to remove the –skip-name-resolve switch. The configuration file is usually located at /etc/mysql/mysql.conf.d/mysqld.cnf or /etc/my.cnf. Open the file using a text editor:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Find the line that contains the –skip-name-resolve switch and comment it out by adding a ‘#’ at the beginning of the line. Save the changes and exit the text editor.

Step 3: Start the MySQL Service

After editing the configuration file, start the MySQL service again:

sudo service mysql start

Step 4: Grant Privileges

Once MySQL is restarted without the –skip-name-resolve switch, you can now grant privileges to users based on their hostname without encountering the ER_WARN_HOSTNAME_WONT_WORK error. Use the GRANT statement to assign the necessary privileges to the user:

GRANT privileges ON database.table TO 'username'@'hostname';

Replace ‘privileges’ with the specific privileges you want to grant, ‘database.table’ with the database and table name, ‘username’ with the user you want to grant privileges to, and ‘hostname’ with the hostname of the user.

Summary

In conclusion, MySQL Error 1285 – SQLSTATE: HY000 (ER_WARN_HOSTNAME_WONT_WORK) occurs when MySQL is started in –skip-name-resolve mode, and you try to grant privileges to a user based on their hostname. To fix this error, you need to restart MySQL without the –skip-name-resolve switch. By following the steps outlined in this article, you can resolve the issue and grant privileges to users without any problems.

For more information about VPS hosting and how it can benefit your website or application, visit Server.HK. Our Hong Kong VPS hosting solutions are reliable, secure, and tailored to meet your specific needs.

Recent Posts

  • Zero Trust Access for Hong Kong VPS: Secure Remote Team Access (2026)
  • Celery Task Queue on Hong Kong VPS: Async Background Jobs (2026)
  • Self-Hosted Object Storage on Hong Kong VPS: MinIO S3-Compatible (2026)
  • Hong Kong VPS vs Singapore VPS: Which for Your Asia-Pacific App in 2026?
  • IoT Data Platform on Hong Kong VPS: Edge Computing for Asia-Pacific (2026)

Recent Comments

  1. Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026) - Server.HK on How to Monitor Your Hong Kong VPS: Uptime, Performance, and Alert Setup Guide (2026)
  2. Best Hong Kong VPS Providers in 2026: Compared by Speed, Routing, and Value - Server.HK on How to Migrate Your Website to a Hong Kong VPS: Zero-Downtime Transfer Guide (2026)
  3. vibramycin injection on How to Choose the Right Hong Kong VPS Plan: A Buyer’s Guide for 2026
  4. allopurinol for gout on CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  5. antibiotics online purchase on How to Set Up a WordPress Site on a Hong Kong VPS with aaPanel (Step-by-Step 2026)

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot