Access denied for user 'root'@'localhost' (using password: NO)
  • 21-May-2023
Lightrun Team
Author Lightrun Team
Access denied for user 'root'@'localhost' (using password: NO)

Access denied for user ‘root’@’localhost’ (using password: NO)

Lightrun Team
Lightrun Team

Explanation of the problem


When using Mobius_Docker, users have encountered difficulties in getting it to function properly. Upon starting the application, the following output is repeatedly displayed:


node_1  | GET : /Mobius
node_1  |
node_1  | GET : /Mobius
node_1  | get_resource_from_url (hokpoASd) - /Mobius: 2.846ms
node_1  | get_resource_from_url (z_wpz8jS) - /Mobius: 3.322ms
node_1  | {"rsc":"5000","ri":"GET-/Mobius-{\"fu\":2,\"rcn\":1,\"rt\":3}","msg":"database error"}
node_1  | Target CSE(localhost) is not ready
node_1  | Target CSE(localhost) is not ready
node_1  | {"rsc":"5000","ri":"GET-/Mobius-{\"fu\":2,\"rcn\":1,\"rt\":3}","msg":"database error"}


Due to the indication of a database error in the message, further investigation was conducted on the database setup. Towards the end of the database setup, the following statement was found:


db_1    | 2020-01-16T15:00:53.686717Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)


Considering this error, the user is seeking a solution to address the issue. The problem has been replicated on different machines, running both Linux and Windows operating systems. The user has followed the manual installation steps from the provided guide, yet the database error persists. Attempts to resolve the “Access denied” error by implementing various solutions found on the internet have been unsuccessful.


Troubleshooting with the Lightrun Developer Observability Platform


Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for: Access denied for user ‘root’@’localhost’ (using password: NO)


To resolve the issue of the “Access denied” error and address the database error in Mobius_Docker, the following steps can be taken:

  1. Grant appropriate privileges to the database user:
    • Access the MySQL server using a privileged account.
    • Execute the following command to grant the necessary privileges to the user ‘root’@’localhost’:




    • This grants all privileges to the ‘root’ user, allowing it to connect to the database without encountering the “Access denied” error.
  1. Update the Mobius_Docker configuration:
    • Locate the configuration file or environment variables used by Mobius_Docker.
    • Update the database connection settings to ensure that the correct credentials are used to connect to the MySQL database.
    • Verify that the hostname, port, database name, username, and password are correctly specified in the configuration.
  2. Restart Mobius_Docker:
    • After making the necessary changes, restart the Mobius_Docker application.
    • Monitor the logs for any further errors or issues.
    • If the database error persists or other errors occur, consult the Mobius_Docker documentation or seek assistance from the Mobius_Docker community for further troubleshooting.

By granting the appropriate privileges to the database user and ensuring the correct database connection settings are used, the “Access denied” error can be resolved, allowing Mobius_Docker to function properly.


Problems with Mobius


Problem 1: Connection Issues with Mobius Server Description: One of the common problems encountered with Mobius is related to establishing a connection with the Mobius server. This can manifest in various ways, such as timeouts, connection refused errors, or unsuccessful authentication attempts. It can be caused by misconfigured network settings, incorrect server URL, or firewall restrictions.

Solution: To resolve connection issues, ensure that the server URL and port are correct and accessible from the client environment. Verify that any firewalls or security groups allow incoming and outgoing connections on the specified port. Additionally, check the network configuration and ensure that the client and server are on the same network or can communicate with each other. Here’s an example of configuring the server URL and port in Mobius:


const mobius = new MobiusClient({
  serverUrl: '',
  port: 8080,


Problem 2: Authentication and Authorization Errors Description: Another common problem with Mobius is related to authentication and authorization. Users may encounter errors indicating invalid credentials, insufficient privileges, or unauthorized access when interacting with Mobius APIs. This can occur due to misconfigured authentication settings, incorrect access tokens, or improper role-based access control.

Solution: To address authentication and authorization errors, double-check the authentication mechanism being used and ensure that the provided credentials or access tokens are valid and have the necessary permissions. Review the documentation or configuration files for the correct format and usage of authentication credentials. If role-based access control is enabled, ensure that the user has the required roles and permissions assigned. Here’s an example of authenticating with Mobius using an access token:


const mobius = new MobiusClient({
  serverUrl: '',
  accessToken: 'your-access-token',


Problem 3: Data Integrity and Consistency Issues Description: Data integrity and consistency problems can occur in Mobius, leading to inconsistencies between the data stored in the database and the expected state. This can result in incorrect query results, data corruption, or failed transactions. Data integrity issues may arise due to concurrent access, improper transaction handling, or database configuration problems.

Solution: To ensure data integrity and consistency, it is important to follow best practices for transaction management and concurrency control. Properly handle transactions to maintain the ACID (Atomicity, Consistency, Isolation, Durability) properties of the data. Use appropriate locking mechanisms or optimistic concurrency control to handle concurrent updates to the same data. Regularly validate and reconcile data to detect and correct any inconsistencies. Review the database configuration and optimize it for performance and data integrity. Here’s an example of using transactions in Mobius:


const transaction = mobius.startTransaction();
try {
  // Perform database operations within the transaction
  await transaction.query('UPDATE ...');
  await transaction.commit();
} catch (error) {
  await transaction.rollback();
  // Handle the error


A brief introduction to Mobius


Mobius is an open-source IoT (Internet of Things) platform that provides a framework for managing and integrating IoT devices and data. It offers a set of APIs and tools to facilitate device registration, data storage, and communication between devices and applications. Mobius is built on top of the oneM2M global standard for IoT interoperability, ensuring compatibility and seamless integration with various IoT systems and protocols.

At its core, Mobius utilizes a hierarchical data model where devices and resources are organized into containers and can be accessed using RESTful APIs. The platform supports various data formats and protocols, such as JSON and MQTT, allowing flexible data exchange between devices and applications. Mobius provides a scalable and reliable architecture, enabling the handling of a large number of devices and data streams. It also offers features like security mechanisms, access control, and data validation to ensure the integrity and privacy of IoT data.

Developers can leverage Mobius to build robust and scalable IoT solutions. They can utilize the provided APIs and SDKs to develop applications that interact with IoT devices, collect sensor data, and control device functionalities. Mobius simplifies the complexities of managing IoT infrastructure, allowing developers to focus on application logic and data analysis. With its extensive support for standards and protocols, Mobius enables interoperability and integration with a wide range of IoT devices and systems, making it a powerful tool for IoT application development and deployment.


Most popular use cases for Mobius

  1. Device Management and Connectivity: Mobius provides a comprehensive framework for managing IoT devices and establishing connectivity between devices and applications. Developers can utilize the platform to register devices, configure device profiles, and monitor device status. The following code snippet demonstrates how to register a device using the Mobius API:


import requests

def register_device(device_id, device_name):
    url = ""
    payload = {
        "id": device_id,
        "name": device_name,
        # Additional device parameters
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer <access_token>"

    response =, json=payload, headers=headers)
    if response.status_code == 201:
        print("Device registered successfully.")
        print("Failed to register device. Error:", response.text)


  1. Data Collection and Storage: Mobius enables the collection and storage of sensor data from IoT devices. It offers a scalable and efficient data storage mechanism that allows developers to persist and query sensor readings, events, and other IoT-related data. The platform supports various data formats, including JSON and XML. Developers can leverage the Mobius APIs to store and retrieve data from IoT devices. The code snippet below demonstrates how to store sensor data using the Mobius API:


const axios = require('axios');

async function storeSensorData(deviceId, sensorData) {
    const url = `${deviceId}/data`;
    const headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer <access_token>'

    try {
        const response = await, sensorData, { headers });
        if (response.status === 201) {
            console.log('Sensor data stored successfully.');
        } else {
            console.error('Failed to store sensor data. Error:',;
    } catch (error) {
        console.error('An error occurred while storing sensor data:', error);


  1. Application Integration and Analytics: Mobius facilitates seamless integration of IoT data into applications and enables advanced analytics on the collected data. Developers can leverage the platform’s APIs and integration capabilities to integrate IoT data into existing applications or build new applications that utilize the insights derived from IoT data. Mobius supports real-time data processing and analytics, enabling developers to extract valuable information from IoT data streams. This empowers businesses to make data-driven decisions and unlock the full potential of their IoT infrastructure.



It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.