# [Solved] Setting up mysql

## noff

I am trying to setup mysql for use with mythtv.

I emerged 4.0.12 and started it.

I ran mysql_install_db.

When I run 

```
mysql < /usr/share/mythtv/database/mc.sql

ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) 
```

I don't have anything set I don't think.  How can I fix this?  I there a way to wipe it all.  The manual didn't help me because tis is a fresh install and it says a fresh install has no permissions.

If I try 

```
/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user: 'root@localhost' (Using password: NO)'

```

I would really like some help.

----------

## splooge

Hmm you can try doing the:

/usr/portage/.../mysql/mysql.ebuild config

thing again to reset the database permissions, etc.  (You will lose all your databases I think)

It looks like you inadvertently set a password possibly running this command earlier.

Try this:

mysql -u root -p

and see if you can't figure out the password you may have used.

----------

## noff

I got the password and was able to install the database.  Now when I try to setup mythtv I get 

```
QSqlDatabase warning: QMYSQL3 driver not loaded

QSqlDatabase: available drivers:

QSqlDatabase warning: QMYSQL3 driver not loaded

QSqlDatabase: available drivers:

Unable to open database:

Driver error was:

Driver not loaded

Database error was:

Driver not loaded
```

Which appears to be a mysql error.

Is there anyway to completely wipe everything about mysql off my computer and start over?undefined

----------

## rizzo

```
emerge -C mysql

emerge mysql

ebuild /usr/portage/dev-db/mysql/mysql-versionblahblah.ebuild config

/etc/init.d/mysql start

rc-update add mysql default
```

----------

## noff

Whenever I run 

```
ebuild /usr/portage/dev-db/mysql/mysql-3.23.56.ebuild config

* Hmm, it appears as though you already have the mysql

 * database in place.  If you are having problems trying

 * to start mysqld, perhaps you need to manually run

 * /usr/bin/mysql_install_db and/or check your config

 * file(s) and/or database(s) and/or logfile(s).

```

I really just want to start over wiping everything.undefined

----------

## rush

I have been faced with the same problem like noff.

After some reading i found this a feature and not a bug.

After you have set a password for a user you (of course) have to use that password for any access to mysql. So the syntax for your problem would be:

mysqladmin -p -u root password 'newpassword'

rush

----------

## splooge

To get rid of the leftovers, try:

rm -rf /var/lib/mysql

----------

## noff

Thank you splooge that is exactly the correct solution.

----------

