[mysql@dbserver bin]$ ./mysql -uroot -pmysql -s /data/db/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/home/mysql/data/db/mysql.sock' (111)
我这里明明是写的 -s /data/db/mysql.sock
怎么提示我: Can't connect to local MySQL server through socket '/home/mysql/data/db/mysql.sock'
赶紧看看mysql的帮助:
./bin/mysql --help
...
-s, --silent Be more silent. Print results with a tab as separator,
each row on new line.
-S, --socket=name The socket file to use for connection.
...
原来 小s是表示静默,大S 才表示 sock
马上更换 成 S
[mysql@dbserver bin]$ ./mysql -uroot -pmysql -S /data/db/mysql.sock
。。。
Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
-B, --batch Don't use history file. Disable interactive behavior.
(Enables --silent.)
-b, --binary-as-hex Print binary data as hex
-c, --comments Preserve comments. Send comments to the server. The
default is --skip-comments (discard comments), enable
with --comments.
-C, --compress Use compression in server/client protocol.
-e, --execute=name Execute command and quit. (Disables --force and history
file.)
-E, --vertical Print the output of a query (rows) vertically.
-h, --host=name Connect to host.
-H, --html Produce HTML output.
-n, --unbuffered Flush buffer after each query.
--column-names Write column names in results.
(Defaults to on; use --skip-column-names to disable.)
-N, --skip-column-names
Don't write column names in results.
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
-P, --port=# Port number to use for connection or 0 for default to, in
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/services, built-in default (3306).
-s, --silent Be more silent. Print results with a tab as separator,
each row on new line.
-S, --socket=name The socket file to use for connection.
-u, --user=name User for login if not current user.
-U, --safe-updates Only allow UPDATE and DELETE that uses keys.
-v, --verbose Write more. (-v -v -v gives the table output format).
-V, --version Output version information and exit.