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\\
or make a start.bat file:
Good luck!
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.
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.
Please perform the following steps
Go to MySQL installed directory and copy path and past on command prompt like:- C:\Program Files\MySQL\MySQL Server 5.7\bin>
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -p [-u for username -p for password]
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -p Enter password: **** [enter your password here]
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
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.