I just installed MySQL version 4.1.20 on my CentOS 4.4 server. The default install of MySQL server uses a blank password for root so I had to have it changed. I also set the MySQL service to start up every time my machine boots up.
This is how I did it;
yum -y install mysql-server (This will install the mysql binaries)
chkconfig mysqld on (Adds mysqld to the startup services)
service mysqld start (Starts the MySQL server)
mysql -u [email protected] (Brings up the MySQL console)
- #mysql> set password for root=password(‘password’); (Sets the root password to “password”)
- #mysql> reload privileges; (Reloads the grant tables)
mysql -u root (Brings up the MySQL console)
- #mysql> use mysql (Use the mysql database)
- #mysql> update user
-> set password=password(“password”) (Sets the root password to “password”)
-> where user=“root”;
reload privileges; (Reloads the grant tables)
That’s it, the next time you want to get the MySQL console up you’ll have to run #mysql -u root -p to get the password prompt.
This will work too.
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h pandora.crib password ‘new-password’