[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 661
  • Last Modified:

Change Default Mysql Port

When I try to login to mysql on my server via console, I get:

$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysqld/mysqld.sock' (38)

It's trying to go to the wrong socket.  Via phpmyadmin, I know it's working correctly at a different socket location: /tmp/mysqld/mysqld.sock  (for instance)

How do I change the default socket location from console, so it always points to the correct location?
0
ecuguru
Asked:
ecuguru
1 Solution
 
ygouthamCommented:
edit the file /etc/my.cnf

the socket is listed in over there and change it to the location that you know is correct
0
 
modcon_jscottCommented:
mysql -u root -p -S /path/to/your/socket

man mysql and mysql --help are good friends to have.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now