When setting up a MySQL database, you may encounter an issue where the root user is only allowed to connect via Unix sockets (localhost
), but not via TCP/IP (127.0.0.1
). This tutorial walks you through resolving the Access denied for user 'root'@'127.0.0.1'
issue by granting the proper privileges to the root user for TCP connections.
- You must have root access to your MySQL server.
- You need to be able to connect to MySQL via the command line using Unix socket (by default
localhost
).