log into sql from command line?

chess314

New Member
Messages
5
Reaction score
0
Points
0
Hi,
I know we can play with mysql from cpanel. What would be the command to get mysql access from a terminal?

Thanks,
kevin
 

Russ

<b>Retired *****</b>
Messages
3,168
Reaction score
2
Points
38
mysql -u xdomain -p -h mysql.example.org xdatabase

where you need to replace domain with your actual domain and example.org with correct domain and .tld.

-u is the switch to specify the user. Your MySQL username is xdomain where domain is your domain.

-p tells MySQL to prompt for a password

-h tells MySQL what host to use. Your host is mysql.example.org (replace with your actual domain and .tld)

xdatabase in the above command line instruction is the name of the database.
 

chess314

New Member
Messages
5
Reaction score
0
Points
0
so im a little confused.
i think my user name for the database is chess and i guess my host is my website on x10hosting which is prototype.x10hosting.com
and my databases name is sample
so i typed in
mysql -u chess -p -h prototype.x10hosting.com sample

and i get this
ERROR 1045 (28000): Access denied for user 'chess'@'63-215-76-17.netwood.net' (using password: YES)

the stuff after the @ is probably not what i want...whats going on?

Thanks
 

naim4u

New Member
Messages
51
Reaction score
0
Points
0
your password mignt be worng orplz check the mysql server name and enter it correctly
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
You need to add in your IP as remote access in CPanel, by default it only allows localhost.
 

chess314

New Member
Messages
5
Reaction score
0
Points
0
youre probably right about cpanel, i added my ip. but for some reason the command keeps failing. this time it says:

ERROR 1045 (28000): Access denied for user 'chess'@'cpe-76-172-84-128.socal.res.rr.com' (using password: YES)

for some reason the hostname changed....isnt the host name supposed to be the name of my website i made on x10hosting?
Edit:
can someone tell me what the host is anyway? is that the name of my computer? or the name of the computer the slq server is on?

Thanks
 
Last edited:

El Jefe

New Member
Messages
1
Reaction score
0
Points
0
im trying log in via the command-line (dont like myPHP much) and i think i followed the above instructions right but im getting

ERROR 2003 (HY000): Can't connect to MySQL server on 'dancetest.x10hosting.com' (10061)
or
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql.x10hosting.com' (10061)

my command line looks something like this

mysql -u test -p -h dancetest.x10hosting.com test

ive tried lots of different variations as im not 100% sure of the above instructions, but ive tried

mysql -u test -p -h mysql.x10hosting.com test
mysql -u username_test -p -h mysql.x10hosting.com username_test
mysql -u username_test -p -h dancetest.x10hosting.com username_test
etc...

but still ERROR 2003...

im sure im just an idiot, but any help would be appreciated
 
Top