Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Oct 2, 2005, 15:37   #1
Sikwondo
SitePoint Addict
 
Join Date: Sep 2005
Posts: 332
How do I connect to my Web Host MySQL...

Hi, I know how I connect to my localhost MySQL database with;

cd /usr/local/mysql/bin/

and press enter. then type

./mysql -u root -p and press enter

How do I connect to my Web Host MySQL through Terminal if for example:

Server: mysql.madeup.net
Database: me1
Username: me1
Password: mypasswd

Thanks,

Simon
Sikwondo is offline   Reply With Quote
Old Oct 2, 2005, 15:44   #2
Sikwondo
SitePoint Addict
 
Join Date: Sep 2005
Posts: 332
I have gone into my database section via my web host, gone to create new database, typed in the name and got this:

SQL-query: Edit

CREATE DATABASE `ijdb` ;

MySQL said: Documentation
#1044 - Access denied for user: 'simonbailey1@%' to database 'ijdb'
Sikwondo is offline   Reply With Quote
Old Oct 2, 2005, 15:47   #3
mwolfe
SitePoint Guru
 
mwolfe's Avatar
 
Join Date: Mar 2005
Posts: 912
use the -h option to specify the host

so it would be something like mysql -h mysql.madeup.net -u me1 -p [hit enter]
then type your password

then type connect me1


http://dev.mysql.com/doc/mysql/en/my...d-options.html
mwolfe is offline   Reply With Quote
Old Oct 2, 2005, 15:53   #4
Sikwondo
SitePoint Addict
 
Join Date: Sep 2005
Posts: 332
Hi,

I got this reply..

Last login: Sun Oct 2 22:32:07 on ttyp1
Welcome to Darwin!
Simon-Baileys-Computer:~ SiBailey$ ./mysql -h mysql.madeup.net -u me1 -p
-bash: ./mysql: No such file or directory
Simon-Baileys-Computer:~ SiBailey$ mysql -h mysql.madeup.net -u me1 -p
-bash: mysql: command not found
Sikwondo is offline   Reply With Quote
Old Oct 2, 2005, 16:05   #5
mwolfe
SitePoint Guru
 
mwolfe's Avatar
 
Join Date: Mar 2005
Posts: 912
if you are connecting to your host via ssh or telnet then you don't need to specify the host option because then the mysql server is on the same computer.

why are you using ./mysql
you should only be using that if you are in the same directory as the msyql command is in. Typically you will have the /usr/bin or whever mysql is in your path and you shouldn't have to cd to the mysql directory in order to connect to it..

just try mysql -u yourusername -p
and not ./mysql
using . means you are referring to a file in the current directory.
mwolfe is offline   Reply With Quote
Old Oct 2, 2005, 16:07   #6
Sikwondo
SitePoint Addict
 
Join Date: Sep 2005
Posts: 332
Quote:
Originally Posted by mwolfe
if you are connecting to your host via ssh or telnet then you don't need to specify the host option because then the mysql server is on the same computer.

why are you using ./mysql
you should only be using that if you are in the same directory as the msyql command is in. Typically you will have the /usr/bin or whever mysql is in your path and you shouldn't have to cd to the mysql directory in order to connect to it..

just try mysql -u yourusername -p
and not ./mysql
using . means you are referring to a file in the current directory.
I don't have a clue what SSH or Telnet are. I am trying to get on through my Mac's terminal. Am new to this (does it show )

I will try the above code, thanks.

Simon
Sikwondo is offline   Reply With Quote
Old Oct 2, 2005, 16:09   #7
Sikwondo
SitePoint Addict
 
Join Date: Sep 2005
Posts: 332
Quote:
Originally Posted by Sikwondo
I don't have a clue what SSH or Telnet are. I am trying to get on through my Mac's terminal. Am new to this (does it show )

I will try the above code, thanks.

Simon

I tried it and it just came up with bad command. Think I'm just gonna give up on this and sell bannanas at some stall.

Since I got this sitepoint book, I have followed what it says to do precisely but still no joy

Thank you for all your help mwolfe

Simon
Sikwondo is offline   Reply With Quote
Old Oct 2, 2005, 17:31   #8
mwolfe
SitePoint Guru
 
mwolfe's Avatar
 
Join Date: Mar 2005
Posts: 912
no giving up man, believe me i've pondered the benefits of selling bananas instead of programming many times.
if you look above, you posted the following :
Quote:
Last login: Sun Oct 2 22:32:07 on ttyp1
Welcome to Darwin!

what happened before this?? it looks to me like you must have connected to some server before this
maybe you typed ssh www.yourhost.com
or you typed telnet www.yourhost.com
or something to that effect

i havent worked on a mac much at all but on all the linux boxes i've worked on i've never seen a message like that when opening a terminal window, the only time i get those kind of messages is when i connect to another server.. But mabye yours does that when you open terminal automatically.
its fairly likely, though, if you are trying to connect to mysql on your host, you can only do so from there computer.. Thus, you connect via ssh or telnet (whichever they support)
they are pretty much the same thing only ssh is encrypted and is more secure.

once you connect its basically the same thing as being on your own computer, except you will see what is on the servers computer. the mysql command should be in your local path, so you should be able to use mysql - u yourusername -p
to connect to mysql from there.. goodluck man, and don't give up, i don't help people so they can give up (you are now obligated to fix it!! =)
mwolfe is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 13:35.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved