For some reason, the Ubuntu guys decided that the owner of the system should not have root priviledges and that they should be forced to use sudo to do everything. To this end, they set the root password to some randomly generated value and don't tell us about it. Then, they set up the first user created as a sudo user and proceed with the system install. To be able to do anything, you must type sudo in front of every command and enter passwords constantly.
If you're like us and think this is b.s., you can do the following:
sudo passwd root root's new password root's new password
Now, you're in business. From here on, you can just do su and enter root's password to get on with your life.
For the MySQL database, the initial installation should set the root password to nothing. If you'd like to change it to something, do this:
mysql -u root set password for 'root'@'localhost' = password('newpwd'); set password for 'root'@'host_name' = password('newpwd'); set password for 'root'@'127.0.0.1' = password('newpwd'); flush privileges;
For older Mythbuntu systems, that don't use upstart, if you forget the MySQL root password or if some clever install software sets it to something you don't know, you can reset it as follows:
cd /etc/init.d sudo ./mythtv-backend stop sudo ./mysql stop sudo mv mysql mysql.orig sudo cp mysql.orig mysql sudo emacs mysql &
Change the line in the startup section that reads:
/usr/bin/mysqld_safe > /dev/null 2>&1 &
To read:
/usr/bin/mysqld_safe --skip-grant-tables > /dev/null 2>&1 &
Save the file, exit the editor, and restart the mysql server:
sudo ./mysql start
Run the MySQL client from the command prompt:
mysql
Issue the following statements in the mysql client. Replace the MyNewPass with the password that you want to use:
update mysql.user set Password=password('MyNewPass') where User='root'; flush privileges; quit
Stop the mysql server and restore the original startup script:
sudo ./mysql stop sudo rm -f mysql sudo mv mysql.orig mysql
Restart the mysql server:
sudo ./mysql start
You should now be able to login to mysql using the root password:
mysql -uroot -pMyNewPass
If all is well, restart the MythTV backend:
./mythtv-backend start
On the newer systems that use upstart, you can carry out what are essentially the same steps to reset it, if you forget the MySQL root password or if some clever install software sets it to something you don't know:
cd /etc/init sudo stop mythtv-backend sudo stop mysql sudo mv mysql.conf mysql.conf.orig sudo cp mysql.conf.orig mysql.conf sudo emacs mysql.conf &
Change the line in the upstart scritp that reads:
exec /usr/sbin/mysqld
To read:
exec /usr/bin/mysqld --skip-grant-tables
Save the file, exit the editor, and restart the mysql server:
sudo start mysql
Run the MySQL client from the command prompt:
mysql
Issue the following statements in the mysql client. Replace the MyNewPass with the password that you want to use:
update mysql.user set Password=password('MyNewPass') where User='root'; flush privileges; quit
Stop the mysql server and restore the original startup script:
sudo stop mysql sudo rm -f mysql.conf sudo mv mysql.conf.orig mysql.conf
Restart the mysql server:
sudo start mysql
You should now be able to login to mysql using the root password:
mysql -uroot -pMyNewPass
If all is well, restart the MythTV backend:
start mythtv-backend