473,471 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to set the root user password?

1 New Member
First of all, I'm not sure if I've set up root password for MySQL server or not. I was following this tutorial http://www.howtoforge.com/centos-5.1...p-ispconfig-p4 to install mysql on my CentOS 5 server.

When I run 'mysqladmin -u root password yourrootsqlpassword', I got this error message:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
Then I go to MySQL prompt running ' mysql -uroot -pPassword' (Password is replaced by actual password)

When I am on MySQL prompt, I run

mysql> select user, host, password from user where user='root'; and I saw there are three root users in the user table:

Expand|Select|Wrap|Line Numbers
  1. +------+-----------+-------------------------------------------+
  2. | user | host      | password                                  |
  3. +------+-----------+-------------------------------------------+
  4. | root | localhost | *FSDFSAFEFSD124521FSDFSFZFD14584FZZFE22F |
  5. | root | li27-127  | *FSDFSAFEFSD124521FSDFSFZFD14584FZZFE22F |
  6. | root | 127.0.0.1 | *FSDFSAFEFSD124521FSDFSFZFD14584FZZFE22F |
  7. +------+-----------+-------------------------------------------+
From this output, can I say that my root user(s) already has password?

Should I have only one root user for 'localhost' and delete the other two from the user table?

Thanks!
Aug 29 '08 #1
2 3782
coolsti
310 Contributor
When you first install MySql on Centos (at least for Centos 4.5 and lower) I think your root does not initially have a password.

Anyway, the way I log on to mysql in a console window is as follows:

mysql -u root -p [databasename]

where the database name in the brackets is optional.

When you use the above, you are then prompted for your password. This is easier if your password has special symbols in it which would maybe confuse putting it after the -p on the mysql command line.

Your three rows for the root user are for root "coming from" three different places. The first and last are probably equivalent, as 127.0.0.1 should be the same on your machine as "localhost". Be careful in deleting any of them, if you don't really know which one should be deleted! I am not sure where mysql thinks you are "coming from" when you log on via a console window.

And yes, the fact that there are entries in the password field does indicate that there is a password set up for the root user in all three cases. This is not the actual password that you would type in, but an encrypted version that you get when you use the mysql password() command.

I cannot remember the command, but you can set or reset your password from within mysql in the console window. Take a look at the documentation. Something like set password etc.
Aug 29 '08 #2
Atli
5,058 Recognized Expert Expert
I cannot remember the command, but you can set or reset your password from within mysql in the console window. Take a look at the documentation. Something like set password etc.
Expand|Select|Wrap|Line Numbers
  1. SET PASSWORD FROM 'user'@'host' = PASSWORD('newPassword');
  2.  
Just for the record :)

P.S.
I changed the thread title to make it a little clearer.
Please avoid using phrases like "please help me" in thread titles.
Check out the Posting Guidelines for tips on how to make good thread titles.

Thanks.
MODERATOR
Aug 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Florian | last post by:
I've been stumbling over this, what I consider strange, behaviour. I installed mySQL on a Win2k machine and tried to change the root password, which didn't seem to work. I changed it this way: ...
1
by: Adam Smith | last post by:
I have a new DB provided by my ISP don't know details of installation, setup etc. I can log in as anybody except root. mysql -h localhost -u mysql Welcome to the MySQL monitor. Commands end...
5
by: MLH | last post by:
I'm supposed to set a password for the MySQL root user. The output of mysql_install_db instructed me to run the following commands... /usr/bin/mysqladmin -u root -h appserver password mynwewpasswd...
1
by: Angus Comber | last post by:
I have set a password for the mysql root user so when I do this: shell> perl -MCPAN -e shell cpan> install DBI cpan> install DBD::mysql install DBD::mysql fails Is there a way I can run...
0
by: damontimm | last post by:
My setup: Mac OS 10.4.4; mysql 4.x ... everything was installed and working fine for some time. Today, I added drupal to my system and had to create a new database in mysql -- now I am having some...
4
by: Bob | last post by:
I'm just starting PHP and MySQL - and really like the book by Welling and Thomsom. I've installed MySQL on my WinXP desktop, along with Apache and PHP. I have not figured out how to set a...
7
by: rajbala.3399 | last post by:
Hi , I want to download sql in my linux system........... # rpm -ivh MySQL-server-5.0.24a-0.glibc23.i386.rpm MySQL-cl ient-5.0.24a-0.glibc23.i386.rpm Preparing... ...
1
usafshah
by: usafshah | last post by:
Hi I'm using linux with mysql , when i type mysql in terminal it says like: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) i'm logged in as root but...
1
by: mattsql22 | last post by:
I just installed Red Hat Enterprise 5, along with MySQL. I have run mysql_install_db and I can see the mysql folder that contains the 'mysql' database with the users. Unfortunately, I can't login...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.