Re: Linux newbie needs help with install of MySQL on Redhat9

From: Dave Millen (postmaster_at_[127.0.0.1)
Date: 11/07/03


Date: Fri, 07 Nov 2003 10:50:22 +0000

On Sun, 02 Nov 2003 18:17:59 -0600, Master Web Surfer wrote:

> [This followup was posted to linux.redhat and linux.redhat.misc]
>
> I am running Redhat Linux 9 on my laptop. The kernel version is 2.4.20-8
>
> I installed the packages for MySQL from the 3 CDs I used to install
> Redhat9 itself. The install went throught without any problems.
>
> Next, according to the MySQL documentation I performed the following
> "Post-installation Setup and Testing" commands :
>
> mysql_install_db
>
> # Note : I saw the expected messages; mesages pertaining to table
> setups.
>
> safe_mysqld --user=mysql &
>
> # Note : The mysql processes were successfully started
>
> mysqladmin version
>
> # I saw the expected output
>
> # Next I attempted to set a password for the root USER # as described in
> the output from the mysql_install_db command
>
> mysqladmin -u mysql password newpass

This should probably be:

mysqladmin -u root password newpass

which will change the password for the root *mySQL* user(see below)

> # I received the following error message
>
> mysqladmin: unable to change password; error: 'Acccess denied for user:
> '@localhost' to database 'mysql''

This is probably because there is no user 'mysql' in the database yet(see
below).

> My question is, what have I done wrong?
>
> Is the "MySQL root USER" mentioned in the output of the mysql_install_db
> command the unix user "mysql" who owns the directory where the various
> files reside or perhaps some other UNIX user (perhaps even root itself)
> ?
>
> How and when do you specify the "MySQL root USER" ??
>
>
MySQL users and unix account users are completely seperate. You do not
need to specify the mySQL root user, it is the only user in the initial,
default install.

To add other users to the access list, you need to use the GRANT
statement(read docs). It is probably easier to add users, change passwords
etc. directly from the mysql command line rather than use mysqladmin. If
you want to run queries etc. as mysql, you should do the following.

[dave@eden dave]$ mysql -h <hostname or IP> -u root <database name> -p
Enter password:
Reading table information for completion of table and column names You can
turn off this feature to get a quicker startup with -A
 
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 10965 to server version: 3.23.25-beta-log
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> GRANT ALL ON *.* to 'mysql' IDENTIFIED BY 'password';
mysql> \q
Bye
[dave@eden dave]$ mysql -h <hostname or IP> -u mysql <database name> -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10982 to server version: 3.23.25-beta-log
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql>

Note that the above allows the mysql user to connect from *anywhere*. You
should read the documentation for correct usage of GRANT and haw to limit
access to (say) localhost.

HTH
Dave