1、本地登录:mysql -u root -p 2、指定端口号登录: mysql -u root -p -P 3306 3、指定IP登录:mysql -h ip -u root -p 4、指定IP和端口号登录:mysql -h ip -u root -p -P3306