Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If MySQL stopped starting immediately after you changed bind-address, the most likely cause is that the configured address is not assigned to the server when mysqld starts. Check the error log first: Cannot assign requested address means the address is unavailable, while Address already in use means another process already owns the port. Correct the address or the competing listener, restart MySQL, and then test both Unix-socket and TCP connections.

What changing bind-address actually changes

bind-address tells MySQL which local network address should accept TCP connections. It is not the address of a remote client, and it does not create an address on the operating system. The address must already belong to an active interface before the MySQL daemon starts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, a setting such as bind-address = 192.168.0.5 works only while 192.168.0.5 is assigned to one of the host’s interfaces. If DHCP, a cloud reconfiguration, a renamed interface, a container network, or boot ordering removes that address before MySQL starts, the daemon cannot bind its listening socket.

Two startup messages point to different problems:

  • Can't start server: Bind on TCP/IP port: Cannot assign requested address means the configured local address is absent or unusable at startup.
  • Can't start server: Bind on TCP/IP port: Address already in use means another process is already listening on the selected port and address.

Do not try to solve both errors by changing the address blindly. Read the complete error output first, because the remedy depends on which failure occurred.

Recover in the safest order

  1. Identify the service name and read the current startup log.
  2. Check whether the configured address is assigned to an active interface.
  3. If the log reports a port conflict, identify the process that owns the port.
  4. Edit the MySQL configuration using a value that matches your network policy.
  5. Restart the correct service and verify its listener.
  6. Test TCP explicitly, then troubleshoot firewall and remote-access settings if local TCP works but remote clients do not.

1. Read the service status and MySQL error output

Linux distributions commonly register the service as either mysql or mysqld. Use the name installed on your system. Check status first:

sudo systemctl status mysql
sudo systemctl status mysqld

One of those commands may report that the unit does not exist; that is normal when the distribution uses the other name. Read the unit journal for the boot and the failed start:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo journalctl -u mysql -b
sudo journalctl -u mysqld -b

Also inspect the MySQL error log or the error output named by the service configuration. Startup failures involving the data directory, grant tables, address binding, and ports are recorded there. Look for the first binding-related error, not only the final systemd summary. A message such as “service failed” is an outcome; the MySQL error line explains why.

If the log says Cannot assign requested address, proceed to the interface check. If it says Address already in use, use the port-conflict procedure below. If neither appears, do not assume bind-address is the cause: a permissions, data-directory, or grant-table error needs a different repair.

2. Confirm that the configured address exists now

List all addresses currently assigned to the host:

ip address

Find the value after bind-address in the active MySQL configuration and compare it character-for-character with the addresses shown by ip address. Check the interface state as well as the address; an address on an interface that is down is not a dependable startup target.

Common reasons a previously valid value disappears include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • DHCP supplied a different address after a lease renewal or reboot.
  • A cloud instance was assigned a new private address.
  • The network interface was renamed or its configuration was not ready when systemd started MySQL.
  • MySQL is running in a container or namespace that cannot see the host address.
  • An address was removed manually or belonged to a temporary interface.

If the configured address is missing, choose one of these approaches:

  • Restore that address through the operating system’s network configuration, then start MySQL after the interface is ready.
  • Replace the setting with the host’s current address when MySQL should listen on one specific interface.
  • Use a loopback or wildcard policy when that matches the required exposure; understand the security consequences before restarting.

Do not set a random address merely to make the service start. A listener on the wrong interface can make local tests pass while leaving the intended network unavailable, or expose the database on an unintended network.

3. Choose the right bind-address value

The correct value depends on which clients must connect and how stable the host’s addresses are.

Value Interfaces exposed Address stability When it fits Controls still required
127.0.0.1 Local loopback only Normally stable on the host No remote TCP clients are required Remote clients cannot connect through this listener; local account and socket controls still apply
A specific current server address Only the selected interface Depends on DHCP, cloud allocation, and interface startup You need interface-level restriction and can guarantee the address exists before MySQL starts Firewall rules and MySQL account permissions must match the intended clients
0.0.0.0 All IPv4 interfaces Does not depend on one changing IPv4 address Multiple IPv4 interfaces must accept connections and the exposure is deliberate Strict host or cloud firewall rules and account-access controls are essential

127.0.0.1 is appropriate for a database used only by applications on the same machine. It deliberately rejects remote TCP clients even when the service is healthy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A specific address limits exposure, but it creates a startup dependency: that address must exist before mysqld binds. This is often a good choice for a server with a stable private address and a clear firewall policy.

0.0.0.0 listens on every IPv4 interface. It can avoid failures caused by one changing address, but it also broadens the set of reachable networks. Use it only when the firewall and MySQL account rules intentionally restrict who can connect. This value does not bypass authentication or firewall filtering.

4. Edit the active configuration and restart MySQL

On Ubuntu, the commonly used server configuration file is /etc/mysql/mysql.conf.d/mysqld.cnf. Other distributions may use a different included file, so edit the file that actually supplies the server’s [mysqld] settings. Avoid changing a client section by mistake.

For a local-only server, the setting might be:

[mysqld]
bind-address = 127.0.0.1

For a host with a known private address, use that currently assigned value:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[mysqld]
bind-address = 192.168.0.5

After saving the file, restart the daemon. A restart is required for the setting to take effect:

sudo systemctl restart mysql

If your system uses the other unit name, run:

sudo systemctl restart mysqld

Immediately check status and the journal again. If the restart fails, do not repeatedly retry while changing unrelated settings; capture the new error and resolve that specific condition.

5. Distinguish a missing address from a port conflict

When the message is “Cannot assign requested address”

Return to ip address and verify the exact configured value. Correct the operating-system network configuration, select the current server address, or choose an intentional loopback or wildcard policy. Then restart MySQL after the interface is online.

If the address appears only later during boot, the problem is ordering rather than spelling. Ensure the network is considered ready before the MySQL unit starts, or use a stable address that is available at boot. The exact unit dependency method varies by distribution, so verify the resulting order in the service status and journal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When the message is “Address already in use”

Find which process is listening on the MySQL port:

sudo ss -ltnp | grep 3306

MySQL’s default TCP port is 3306. The output identifies the local address, port, process, and usually its process ID. A second MySQL instance, a different database daemon, or a stale service may own it.

Stop the competing service if it should not run, or configure one service to use a different port and update every client, firewall rule, and connection string that depends on 3306. Do not kill an unknown process without confirming its role. If two MySQL instances are intentional, each needs its own data directory, service definition, port, and appropriate bind policy.

6. Verify the listener instead of relying on a successful local login

A local MySQL login can use a Unix socket and therefore says nothing about whether TCP is listening. Verify the socket table directly:

sudo ss -ltnp | grep 3306

Interpret the local address shown in the output. 127.0.0.1:3306 accepts TCP only from the local host. A specific private address accepts connections through that interface. A wildcard IPv4 listener covers all IPv4 interfaces, subject to firewall and account controls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Force a TCP test by specifying a host explicitly:

mysql -h 127.0.0.1 -P 3306 -u your_user -p
mysql -h 192.168.0.5 -P 3306 -u your_user -p

Use the first command to test local loopback TCP and the second with the server’s actual address when that interface should serve clients. Replace the example user and address with values from your installation. In contrast, a command that uses localhost may select the Unix socket, depending on the client and platform.

Test in this order:

  1. Confirm the service is active.
  2. Confirm a listener exists on the expected address and port.
  3. Connect over TCP from the server itself with an explicit -h.
  4. Connect from an authorized remote host only after local TCP succeeds.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why local connections work while remote clients fail

Three independent settings commonly explain this pattern.

The listener is loopback-only

If bind-address is 127.0.0.1, MySQL listens for TCP connections only on loopback. Local applications can work, but a remote client cannot reach that listener. Bind to the intended server interface or to a deliberate wildcard policy, then protect the exposed interfaces with firewall and account rules.

TCP networking is disabled

If the server was started with skip_networking enabled, it cannot accept TCP/IP connections at all. Remove or disable that setting when TCP access is required, restart MySQL, and verify that a TCP listener appears.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A firewall blocks the port

Even with the correct bind address and an active listener, the host firewall or cloud firewall may reject or drop TCP 3306. Permit the port only from the networks that need it. A broad inbound rule can expose the database unnecessarily; a rule limited to the application subnet is safer when that topology is known.

After firewall changes, repeat the explicit TCP test from an authorized remote system. If the connection reaches MySQL but authentication fails, investigate MySQL account host permissions rather than changing bind-address again. Network reachability and account authorization are separate checks.

Boot, DHCP, and cloud-address failure patterns

It worked until the server rebooted

A reboot can change DHCP assignments or alter the order in which interfaces become ready. Compare the address in the MySQL configuration with ip address after boot, then inspect the MySQL journal for the exact failure time. If the address changed, either reserve or statically configure the intended address at the operating-system or cloud layer, or bind MySQL to a policy that does not depend on one temporary address.

It works after a manual restart but not during boot

This usually indicates that the network address exists by the time you restart manually but was absent when the service first launched. Confirm the boot-time journal and arrange for MySQL to start after the network is ready. A manual restart is a useful diagnostic, not a durable fix.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

It works on the host but not inside a container

Check the addresses visible inside the container’s network namespace. A host address may not exist inside the container, and binding to it will fail even though the host shows that address. Bind to an address available in the container or adjust the container network design, then publish and firewall the selected port deliberately.

Configuration checks that prevent repeat failures

  • Keep one authoritative bind-address setting in the active server configuration; conflicting included files can make troubleshooting confusing.
  • Document whether the selected address is static, DHCP-assigned, cloud-managed, or container-local.
  • Record the service name, configuration file, port, allowed client networks, and firewall rule together.
  • After every network change, verify both the listener address and an explicit TCP connection.
  • Do not treat a successful socket login as proof that remote TCP access works.
  • Review skip_networking whenever no TCP listener appears, even though local socket logins succeed.

A compact decision tree

  1. Does the service fail to start? Read the MySQL error output and journal.
  2. Does it say “Cannot assign requested address”? Compare bind-address with ip address; restore, replace, or deliberately broaden the address policy.
  3. Does it say “Address already in use”? Inspect port 3306 with ss, then stop the competing process or assign a different port.
  4. Does the service start but show no TCP listener? Check skip_networking, the effective configuration, and the selected port.
  5. Does local explicit TCP work but remote access fail? Check the listener interface, host or cloud firewall, and MySQL account authorization.
  6. Does only a socket login work? Test with mysql -h 127.0.0.1; the socket path does not validate TCP.

What a successful repair looks like

The repair is complete when the configured address is present before startup, the service remains active after a restart, the listener appears on the intended address and port, and an explicit TCP connection succeeds from each network location that should be allowed. Remote access should work only through the interfaces and firewall paths you intentionally exposed; a service that starts is not, by itself, proof that the network design is correct.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.