Alex Brown wrote:
Hi.

Thanks for the prompt reply.

It seems strange that the installation procedure should include an instruction that requires a password with no indication that one is required (i.e. there is no -p in the command sequence). Reading through Mark Liyanage's installation instructions, I notice that the second command ( /usr/local/mysql/bin/mysqladmin -u root -h localhost password mysql) is not included.

I assume you are talking about the directions given at the end of the run of mysql_install_db. That script uses /bin/hostname to look up your mmachine's hostname. When setting up the user table, it creates an entry for [EMAIL PROTECTED] with no password and an entry for [EMAIL PROTECTED] with no password. At the end, it gives the instructions


  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
  This is done with:"
  $bindir/mysqladmin -u root password 'new-password'
  $bindir/mysqladmin -u root -h your_hostname password 'new-password'
  See the manual for more instructions.

where $bindir is the path to the mysql executables (/usr/local/mysql/bin, in our case).

In theory, when you run the second command given, you will be connecting as [EMAIL PROTECTED] rather than [EMAIL PROTECTED], so no password will be needed because you haven't set it yet. (So far you've only set the password for [EMAIL PROTECTED], in the first command). I gather from your description that the second command was given to you as

mysqladmin -u root -h localhost password 'new-password'

This is redundant (it's equivalent to the first command) and won't work without the password you set in the first step. I have a suspicion that your /bin/hostname command is returning localhost instead of blah.local, or at least did so back when you ran mysql_install_db.

The other possible complication here is that mysql_install_db won't mess with your user table if you already have one. This is a very good thing, but it sometimes bites people who, like you, installed mysql once before but didn't get very far, as the instructions assume the user table looks the way mysql_install_db creates it.

Your recommended instruction to set the password from inside MySQL (GRANT ALL ON *.* TO [EMAIL PROTECTED] IDENTIFIED BY 'newpassword') worked fine.

My (perceived) problem with the PowerBook is that when at work the PowerBook is connected to a server via an Ethernet connection - the server then gives the PowerBook a hostname which is different from that when I have the PowerBook at home (and not networked): in both locations `hostname` gives different results. Could I set-up a root user (or any other user) with the '@%' hostname ?

You shouldn't need a [EMAIL PROTECTED] account in mysql to connect to the mysql server on the same machine. Simply leave out the "-h hostname" when you connect, like this:


mysql -u username -p

This will prompt you for the password to connect as [EMAIL PROTECTED] You usually use the [EMAIL PROTECTED] account(s) to allow connections from other hosts.

That said, you can set up mysql to work with your changing hostname if you want/need to. You can, as you suggest, use the wildcard '%' for the hostname, but that allows that user access from EVERYWHERE, leaving only the password as protection. A better idea would be to create [EMAIL PROTECTED] accounts with the hostname specified or constrained, so as to limit access to the named machines. Some possibilities:

* If your PowerBook has 2 separate hostnames (1 at home, 1 at work), or you want to allow access from 2 specific external hosts, say host1 and host2, you can create a [EMAIL PROTECTED] account and a [EMAIL PROTECTED] account.

* If your hostname varies somewhat (using DHCP, for example), or you want to give a user access from any machine in your domain, say 1.2.3.x, where x varies, you can create a [EMAIL PROTECTED] account.

See section 4.4 in the manual for more details.
<http://www.mysql.com/doc/en/User_Account_Management.html>

I would hope to read through the Reference Manual, but at 800 - 1000 pages, I thought I might wait for the video :)

It is huge, but I find reading the section relevant to my current task is usually quicker than figuring out what I did wrong. YMMV.


Michael


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to