问:当我使用mysql客户端时mysql -u root -p -h
密码在客户端与服务器建立连接之前,还是之后弹出提示?
答案:在客户端建立到服务器的连接之前。
lovegood:~ byte$ mysql -uroot -p -hlocalhost Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 1 Server version: 5.2.8-MariaDB Source distribution This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> q Bye lovegood:~ byte$ mysql.server stop Shutting down MySQL . SUCCESS! lovegood:~ byte$ mysql -uroot -p -hlocalhost Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)