Results 1 to 6 of 6

Thread: MySQL setup

  1. #1

    MySQL setup

    I just installed MySQL on a Red Het 8.0 box. I followed the directions in the Red Hat 8.0 Bible and it seemed really simple until I tried it. After the install, I ran the command "mysqladmin -u root password my password". I then replaced the my.cnf file with the my-medium.cnf file and modified the password entry to reflect my password. After this I restarted mysqld. When I try to access anything and I'm prompted for a password I receive: "mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user: 'root@localhost' (Using password: YES)'".

    I've tried several things since, from replacing the my.cnf file with the original to adding an entry in my iptables file for MySQL. I've checked my log file and there is no sign here. I have noticed the error refers to "root@localhost" and my machine name is not localhost. Could this be the problem? I am grasping at straws here. Any help would be greatly appreciated.

    -mtfriend

  2. #2
    Associate
    Join Date
    Dec 2002
    Posts
    13

    Re:MySQL setup

    I think this "root@localhost" thing is not the problem. "localhost" should be a valid name for every computer referring to itself no matter what its actual name is. Likewise the IP-address 127.0.0.1 always refers to the computer itself, no matter what its actual IP-address is.

    It sounds like you have put the password in "/etc/mysql/my.cnf" (or on RedHat purhaps "/etc/my.cnf" or whatever place within /etc). This is not a good idea, and probably won't work. You should put it in a file called ".my.cnf" (notice that the file name starts with a dot) in your home-directory, and use the original /etc/mysql/my.cnf.

    So, restore the original "my.cnf", restart the mysqld server (or reboot if you don't know how to do this) and create a /root/.my.cnf (notice the dot) that just reads:

    [mysql]
    user = root
    password = <your password>

    [mysqladmin]
    user = root
    password = <your password>

    After creating it do a "chmod 0700 /root/.my.cnf" (important for security).
    Log into your Linux system as root. Now you should be able to start "mysql" just like that, without any further commandline options. Type the SQL-command "SELECT USER();" to verfiy that you are really logged in to MySQL as "root@localhost".

    You can do this for normal user accounts on your Linux system as well, provided you have created the user names in MySQL (with GRANT ....).

    If this still doesn't work then try the -p option to the mysql command, to have it explicitly ask for your password, i.e. "mysql -u root -p".

  3. #3
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:MySQL setup

    [quote author=mtfriend link=board=2;threadid=6377;start=0#60152 date=1045368939]
    I ran the command "mysqladmin -u root password my password"
    [/quote]

    Try :: mysql -u root -p
    And then when it prompts then type the p/w in. That is exactly what I do.

  4. #4

    Re:MySQL setup

    OK. I'm beginning to feel like an idiot. I mean it can't be this difficult to login into MySQL. Can it? As I said in my earlier post I was following the instructions in The Red Hat 8.0 Bible. After installing I ran mysqladmin -root password "my password" (without the quotes). I then proceeded to muck things up and that is listed above. Anyway, I followed your advice Hko. I restored my original /etc/my.cnf and I created a new /root/.my.cnf. I only added the lines:
    [mysql]
    user = root
    password = <your password>

    [mysqladmin]
    user = root
    password = <your password>

    By the way I tried the password with <> and without the <> and the password is the same as what I used to begin with in the line mysqladmin -u root password "my password"

    I then restarted mysqld and while logged in as root typed mysql. I got the following message:
    ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
    I then tried to force it to prompt me for a password (mysql -u root -p) and got the same message as before.

    Any other suggestions. Can I some how reset the password mysql thinks I am supposed to use? It has to be something simple that I am overlooking. It usually is.

    Thanks,
    -mtfriend


  5. #5

    Re:MySQL setup

    Well I found the answer. I'm not sure if this is the "answer", but it solved my problem. Basically I launched safe_mysqld and flushed privelages. Here is a link to the site where I found the syntax: http://www.cylug.org/pipermail/cylug...ry/000412.html

    Thanks for the help!
    -mtfriend

  6. #6
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:MySQL setup

    Well, that would not haev been my first guess ;D

    But the process you descibed is perfect for fixing password issues. Like forgotten or corrupted passwords. I havent used it professionally, so I cant really comment too much on it. I am just in the process of building a DB and an app to go with it for personal reasons. I own a book too and it seems okay (O'Reilly MySQL)

Similar Threads

  1. installed mysql and php, trying to setup phpmyadmin to no avail
    By beemer832 in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 04-15-2010, 07:34 PM
  2. Unable to setup a NIS server setup on CentOS system
    By swatidas in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 01-19-2010, 02:42 PM
  3. MySQL install/setup
    By beemer832 in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 11-23-2009, 04:54 AM
  4. Problem starting mysql conflicts with the RPM "mysql-5.0.27-1.fc6"
    By kamakshiganesh in forum Redhat / Fedora
    Replies: 2
    Last Post: 10-26-2007, 04:35 AM
  5. MySQL Setup help
    By mcdougrs in forum Linux - Hardware, Networking & Security
    Replies: 18
    Last Post: 10-24-2002, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •