[Zope] Re: mysql connection string

Andy Dustman andy@dustman.net
Mon, 15 Jan 2001 11:24:20 -0500 (EST)


On Mon, 15 Jan 2001, Olaf Zanger wrote:

> first:
> right now my setup uses a connection string "db root" which doesn't seam
> to give a lot of savety :-). 
> at my provider i have a login, but sure no root access to the db. 
> * how does the connection string look for user name "peter-hauser" and
> password "test3-.2"?
> * has the user to be set up in "linux" ?
> * how is the setup made in "mysql"?
> i tried with "grant all privileges on *.* to "peter-hauser"@localhost;"
> and "set password for "peter-hauser"=password('test3-.2');"
> but wasn't successful.
> * has zope to be run by user "peter-hauser"?
> 
> second?
> to set up a 3-tier application i should know how to connect mysql
> through MySQL-python 0.3.0 and ZMySQLDA 2.0.1 to my db-server.
> 
> * i can browse from the zope server to the db-server "pit" and otherway
> round with the names "pit" and "pitechon", so "hosts" file should be
> correct. 
> 
> * how has the connection string to look like?
> i tried "db@pit 'peter-hauser'" but it didn't work?
> * has mysql to be started with an special flag to open a port?
> * does it work with the ip-number?

I thought what it printed when you created the connection would be
sufficient:

The connection string used for Z MySQL Database Connection is of the form: 

       database[@host[:port]] [user [password [unix_socket]]]

or typically: 

       database user password

to use a MySQL server on localhost via the standard UNIX socket. Only
specify host if the server is on a remote system. You can use a
non-standard port, if necessary. If the UNIX socket is in a non-standard
location, you can specify the full path to it after the password.

...so you want something like: db@pit peter-hauser test3-.2
If pit is the local host: db peter-hauser test3-.2
...will be faster and use the standard UNIX socket.

You do not necessarily need a UNIX user by that name. Your GRANT statement
looks basically correct, but check the MySQL documentation.

-- 
Andy Dustman         PGP: 0xC72F3F1D
    @       .net     http://dustman.net/andy