How to connect from windows command prompt to mysql command line

后端 未结 16 1831
南旧
南旧 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:07
    1. Start your MySQL server service from MySQL home directory. Your one is C:\MYSQL\bin\ so choose this directory in command line and type: NET START MySQL
      (After that you can open Windows Task Manager and verify in Processes tab is mysqld.exe process running. Maybe your problem is here.)
    2. Type: mysql -u user -p [pressEnter]
    3. Type your password [pressEnter]

    or make a start.bat file:

    1. add C:\MYSQL\bin\ to your PATH
    2. write a start.bat file
    3. My start.bat file has only two lines like below:
      net start MySQL
      mysql -u root -p

    Good luck!

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

    Simply to login mysql in windows, if you know your username and password.

    Open your command prompt, for me the username is root and password is password

    mysql -u root -p
    Enter password: ********
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.7.11-log MySQL Community Server (GPL)
    

    Hope it would help many one.

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

    C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u username -p

    Then it will ask for the password. Enter the password you set for the username during installation while adding db Users.

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

    Please perform the following steps

    1. First, open your command prompt with Administrator.
    2. Go to MySQL installed directory and copy path and past on command prompt like:- C:\Program Files\MySQL\MySQL Server 5.7\bin>

    3. C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -p [-u for username -p for password]

    4. C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -p Enter password: **** [enter your password here]

    1 first image

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

    syntax to open mysql on window terminal as:

    mysql -u -p

    e.g. mysql -uroot -proot

    where: -u followed by username of your database , which you provided at the time of installatin and -p followed by password

    Assumption: Assuming that mysql bin already included in path environment variable. if not included in path you can go till mysql bin folder and then run above command. if you want to know how to set path environment variable

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

    I have used following command to connect MySQL Server 8.0 in Windows command prompt.

    C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p my_db
    Enter password: ****
    

    or

    C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p my_db -h localhost
    Enter password: ****
    

    Here my_db is schema name.

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