How to connect from windows command prompt to mysql command line

后端 未结 16 1833
南旧
南旧 2020-12-12 23:30

I\'m trying to connect to mysql server command line from my windows prompt

I write the next line in cmd but i get an error.

cd C:\\MYSQL\\bin\\


        
相关标签:
16条回答
  • 2020-12-13 00:15

    First jump to the mysql bin directory. You have two ways to connect

    1) mysql -u root -p1234 (without space for password flag) 2) mysql -u root -p and enter the password when it is asking

    0 讨论(0)
  • 2020-12-13 00:17

    Use this :

    mysql -u user_name -p  then press_enter_key
    

    then type password

    i.e.

    line-1 : mysql -u root -p
    
    line-2 : admin
    
    0 讨论(0)
  • 2020-12-13 00:17

    Your have to go on mysql installed path is on drive C:, then your commands need to be:

    C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql.exe -u root -p
    
    OR
    
    C:\>cd \MYSQL\Bin
    C:\MYSQL\Bin>mysql -u root -p
    

    That will ask your MySql password over command prompt:

    Enter password: ******
    

    Put the password and you will get mysql dashboard.

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4622
    Server version: 5.7.14-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    

    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    0 讨论(0)
  • 2020-12-13 00:18

    first type cmd then the windows command prompt will appear:

    PATH C:\XAMPP\MYSQL\BIN;%PATH%;
    mysql -u root -p
    

    where:

    • -u is the user id
    • -p is the password, if you will not using a password just leave it blank.
    0 讨论(0)
  • 2020-12-13 00:18

    If you don't want to go to bin folder of MySQL then another option is to put a shortcut of mysql.exe to your default path of command prompt (C:\Users\"your user name">) with the contents of:

    mysql -u(username) -p(password)
    
    0 讨论(0)
  • 2020-12-13 00:19

    You are logging in incorrectly; you should not include = in your login. So to log in, type:

    mysql.exe -uroot -padmin
    

    If that doesn't work, then you may not have your system configured. If so, then here's a good tutorial on getting started with the MySQL prompt: http://breakdesign.blogspot.com/2007/11/getting-started-with-php-and-mysql-in_11.html

    0 讨论(0)
提交回复
热议问题