Question

how to change the root password in mysql?

Asked by: Sam80

I have installed mysql just now ,but i dont know how to change the root password .

as i type in './mysql_secure_installation' ,it shows:

Enter current password for root (enter for none):

and I type some word or none and enter , it shows:

Set root password? [Y/n]:  , I type Y,and type in my new password two times ,but at last ,it said :

./mysql_secure_installation: mysql: command not found
Password update failed!

I dont know why, the guide document I follow ask me to type in 'mysqladmin' to change password, but I can not find the mysqladmin script or execurte file. but in the /usr/bin , 'mysql_secure_installation' shows me the configuration of the password function . is that the problem from the differences of the versions ?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-07-15 at 01:54:59ID20678779
Tags

password

,

mysql

,

change

,

root

Topic

MySQL Server

Participating Experts
4
Points
20
Comments
28

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. mysqladmin syntax error
    On a fresh install of MySQL 4.1.3B, I'm running this line in the windows command shell before a password has been set: c:\mysql\bin\mysqladmin -u root password mypassword . . .and I get the error: "the syntax of the command is incorrect." . . .and yet the script ...
  2. Mysqladmin Acccess Denied
    I'm trying to access a MySQL database through mysqladmin. I have run into a huge headeache. Here's what I am doing: C:\Program Files\MySQL\MySQL Server 4.1\bin\> mysqladmin [-u, -p] root my_password After I send the command the system returns the following: "mysq...
  3. mysqladmin and Access denied for user 'root'
    Hi These all work: mysqladmin ping mysqladmin status These all don't: mysqladmin -u root -p status mysqladmin -p status mysqladmin --no-defaults -p status In each case I get: <pre> Enter password: mysqladmin: connect to server at 'localhost' failed error: 'Acces...
  4. MYSQL 4.1 CREATING HEADACHE: /usr/bin/mysql…
    Good afternoon, In the case below, MySQL has been installed via YaST using Suse's 9.3 Professional CD's. I have SuSE 9.3 running on an IBM xSeries 306 blade. Server version: 4.1.10a Host: linux.continentalweb.com (172.16.4.8) also within my /etc/hosts file (see below) Host...
  5. mySQL problem
    Hi, I installed mysql4 through yum install mysql or also tried to install mysql5 via its rpm, both installed fine. However when i type mysql or mysqladmin in root, it says command not found! My mysql is running and i tried to do this but it failed. # /usr/local/mysql/bin/m...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: slyongPosted on 2003-07-15 at 03:30:51ID: 8924118

Hi Sam80,

Depending on what you install (source, rpm, binary distribution, pkg) mysql files might be in different locations.  Look into /usr/bin, /usr/local/bin and try to find mysqladmin there.

 

by: VGRPosted on 2003-07-15 at 11:11:09ID: 8927723

first type "mysql" : if you get "command not found", put the installationdir of mysql plus '/bin' in your path ;-)

then do :

mysql --user=root
(type enter for empty password)

then change the password for root :
update mysql.user set Password=PASSWORD('your_new_root_password') where User='root' and Hostname='localhost';
flush privileges;
quit;

that's all

 

by: Sam80Posted on 2003-07-15 at 19:41:03ID: 8930600

my install file is rpm, mysqll-server-4**.rpm

and I use rpm -ivf to install it ,but I dont kown how to specify the installation directory

I still can not find the directory .

i download the mysql from www.mysql.com -> download
there is a  version with '(recommanded)' mark.

 

by: VGRPosted on 2003-07-15 at 21:59:25ID: 8931158

whereis mysql

--> install directory/bin

 

by: VGRPosted on 2003-07-15 at 21:59:51ID: 8931161

or :

locate mysql


or :

find / -name mysql

 

by: Sam80Posted on 2003-07-16 at 00:23:13ID: 8931897

how to uninstall mysql ? I use rpm to install it

 

by: VGRPosted on 2003-07-16 at 00:51:50ID: 8932022

rpm -u or -U

 

by: VGRPosted on 2003-07-16 at 00:51:58ID: 8932023

but why ?

 

by: Sam80Posted on 2003-07-16 at 01:22:27ID: 8932202

there are so many different introductions on the web about the installation of Mysql,other applications in linux as well.

I realy dont know which one to follow . I am in a mess.

I download another document of mysql installation, so I decide to unintall the old one.

 

by: slyongPosted on 2003-07-16 at 05:09:50ID: 8933407

Hi Sam80,

I have just downloaded MySQL from http://www.mysql.com/ the RPMs for Linux i86 and install it on RedHat 7.3.  The packages I installed are as follows:

MySQL-devel-4.0.13-0
MySQL-client-4.0.13-0
MySQL-shared-4.0.13-0
MySQL-server-4.0.13-0
MySQL-Max-4.0.13-0

all mysql binaries (mysql, mysqladmin, etc) are located in /usr/bin.  Just do mysqladmin -u root password 'newpassword' to change the admin password.

To check which rpm you have installed, do:
$ rpm -qa | grep mysql; rpm -qa | grep MySQL

To uninstall the packages (take the above MySQL packages as example),
$ rpm -e MySQL-devel MySQL-client MySQL-shared MySQL-server MySQL-Max

rpm will remove all the packages.

 

by: Sam80Posted on 2003-07-16 at 18:52:47ID: 8939385

thanks slyong, I have uninstall it successful ,and now ,I should learn how to config the linux server
the function it includes should be :

web server  -  apache + tomcat
mail & database server - qmail +  mysql + some administrate software

the qmail should connect to the mysql (i am unable to describe in detail ,maybe like some infomation on web about qmail + mysql )

please give me some correct direction to follow.

 

by: Sam80Posted on 2003-07-16 at 18:58:56ID: 8939408

oh ,by the way ,how to deny sendmail when boot ?
there is nothing in sendmail , I just dont want to start it

 

by: paullamhkgPosted on 2003-07-16 at 21:01:19ID: 8939912

Hi Sam80,

now you see other helping u :)

VGR is the expert's expert here, I try my best to catch up like him, but failed :(

you may try using 'setup' in the command console, select the 'System service', go down and un check the sendmail service, this will do :)

or go to /etc/rc.d/rc3.d/  remove the link some like 'S80sendmail -> ../init.d/sendmail',will also do :)

Paul

 

by: paullamhkgPosted on 2003-07-16 at 21:06:33ID: 8939942

oh for about the administration software, try the webmin is a good tool to know you can get it here http://www.webmin.com/ , try it sure you will love it.

I suggest you better put your difference question into other area ;)

 

by: Sam80Posted on 2003-07-16 at 23:16:53ID: 8940665

paul , are you HongKongese?

 

by: paullamhkgPosted on 2003-07-16 at 23:27:32ID: 8940782

Yes, I'm from Hong Kong. What about you?

 

by: paullamhkgPosted on 2003-07-16 at 23:28:57ID: 8940788

Yes, I'm from Hong Kong.

How are you? where you form? :)

 

by: Sam80Posted on 2003-07-17 at 01:02:10ID: 8941205

I see!! I dont install the mysql-client !!! ,after I install it ,I can run 'mysql' and 'mysqladmin'

and now the problem is : when I use the syntax from VGR ,
update mysql.user set Password=PASSWORD('your_new_root_password') where User='root' and Hostname='localhost';

it shows :
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
mysql>



 

by: Sam80Posted on 2003-07-17 at 01:04:37ID: 8941218

Guang Zhou, China.  ;-)

 

by: Sam80Posted on 2003-07-17 at 01:20:14ID: 8941250

woo!!!! I did it ,I can config my root password in mysql.

now I do "select * from mysql.user where User='root'" it shows two records to me.

host  |  User  | Password
local        |   root     | 23d234sdksdf (encrypted pwd)
localhost |   root     | 23d234sdksdf (encrypted pwd)  

the password are the same because I update both to the same password where the user='root'

in VGR's syntax, it just update the password where the host='localhost'

will it be all right ?

 

by: Sam80Posted on 2003-07-17 at 01:29:02ID: 8941271

any GUI adminstration tools for mysql in linux ? where I can download it?

 

by: paullamhkgPosted on 2003-07-17 at 02:32:56ID: 8941426

why not webmin?? I went GZ very offen, can you give me your email address, may be we can meet when I go to GZ ok? my is paullamhkg1997@hotmail.com

 

by: slyongPosted on 2003-07-17 at 05:26:18ID: 8941873

Sam80,

I have phpMyAdmin (http://www.phpmyadmin.net/) for Web access to MySQL database.  You need to have apache, php >= 4.1.0,  4.1 =< mysql >= 3.23.32 installed.  I am not sure which distribution of Linux are you using.  I assume that you are using RedHat... Using your installation CD, you should be able to find php-mysql-xxx.rpm php-xxx.rpm httpd-xxx.rpm. Install the three packages using:
$ rpm -Uvh httpd-xxx.rpm php-xxx.rpm php-mysql-xxx.rpm

then as root restarts all services
$ su -
# init 5

You should have apache, php installed... take it from there to install phpMyAdmin.

 

by: VGRPosted on 2003-07-17 at 08:57:37ID: 8943890

delete * from mysql.user where Host='local';

smells like a typo to me

 

by: Sam80Posted on 2003-07-17 at 18:52:38ID: 8948556

Thanks guys ,thanks for all your help.

Now I have mainly know about the linux.  (red hat)

sorry VGR ,it seems that my question is a little naive to you,and I will keep improving myself.

 

by: VGRPosted on 2003-07-17 at 22:12:10ID: 8949220

well, here's wat ***usually*** is in there (congratulations for having solved your problem by yourself :D )

-localhost/root/password
-%/root/password
-127.0.0.1/root/password

and you have to add new users (with more limited privileges) for using in your programs. It's a slight security issue to use 'root' which is fully-priviledged (can DROP DATABASE etc)

 

by: rabiaahPosted on 2004-04-17 at 06:06:55ID: 10849001

Dear ,

I have the Explaination in a Word File Application , if you need the
solution , please send an Email Address and I will Reply you the
File ...

Sincerely ..

Rabia Abu-Hanna

Nazareth - Israel
MCP-MCSD-Software Engineer
http://www14.brinkster.com/askadenia

 

by: rabiaahPosted on 2004-04-17 at 06:11:15ID: 10849012

Set Password to SQL Server 7.0/2000

By : Rabia Abu-Hanna


1.      We need Open the Following Path :

[Console Root ]  >>> [Microsoft SQL Servers] >>> [SQL Server Group] >>> [Server Name] >>> [Security] >>> [Logins] >>>

We need to Open the Properties of “ BUILTIN\Administrators “ and then to Choose into the Topic “General” :
( Deny Access ) of the Windows NT Authentication .


2.      We need to open the Properties of the user : “sa”
To Choose : SQL Server Authentication and then Add the
Password for the “sa” username !!!!

3.      To Return back to the Basic Window of the SQL , and to Click
Right Click on the [Server Name] >>> [Edit SQL Server          Registration Properties] >>> and then to choose :
“Use SQL Server Authentication”
set the username = “sa”
Select the CheckBox at bottom “Always prompt for Login name and password “ , and then to Click ok ..

4.      From the Visual Basic Module :

We Need to Create the Connection String For Exp. :

strCnn = "Provider=SQLOLEDB.1;Initial Catalog=DBName;Data Source=local"

From the Connection Options we need to Call the Statement as follows :

With cn
     .Open strCnn, "sa", "*********"
End With

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...