Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Connect to MySQL database

Question posted by: miraan (Newbie) on June 26th, 2008 06:18 PM
This may seem REALLY obvious, but I am a beginner at MySQL and I have just created a new database in phpmyadmin. I have now opened up the mysql console in cmd, but how do I actually connect to the database. My server would just be localhost. I do not know the basic syntax to connect to a mysql database actually within the mysql cmd. The mysql cmd is the one where it looks like:

mysql>

Please help.
realin's Avatar
realin
Familiar Sight
249 Posts
June 27th, 2008
05:58 AM
#2

Re: Connect to MySQL database
i dont understand why you need a console based interface when you got nice gui like PHPmyadmin and mysql query tools if u are a starter level user.
Anyways to connect to mysql thru command line, you path variable shoul be poiting towards bin directory, and if u dontknow how to do that then simply goto install directory and browse into bin folder. say

c:\mysql_install_die\bin

then in the command line write mysql -u username password
to change/select the schema/database write use schema_name
then ur queries ..

hope this helps
cheers !!

Reply
miraan's Avatar
miraan
Newbie
23 Posts
June 27th, 2008
05:37 PM
#3

Re: Connect to MySQL database
Hi, can you give me an example of this please. I do not want to use phpmyadmin because I want to get used to the console.

Reply
realin's Avatar
realin
Familiar Sight
249 Posts
July 3rd, 2008
05:55 AM
#4

Re: Connect to MySQL database
Quote:
Hi, can you give me an example of this please. I do not want to use phpmyadmin because I want to get used to the console.


i have given u an example already.. please read the above reply

Reply
r035198x's Avatar
r035198x
Administrator
10,754 Posts
July 3rd, 2008
06:51 AM
#5

Re: Connect to MySQL database
Quote:
...

then in the command line write mysql -u username password
...

Better make that

Expand|Select|Wrap|Line Numbers
  1. mysql -u username -p 

and then type the password when prompted.
<nitpicking>

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,872 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top MySQL Forum Contributors