# MySQL 5.6 installation database appears corrupt



## Johnny2Bad (Sep 22, 2015)

Hello out there,
Having difficulty setting up MySQL 5.6 at the moment.

Here's my version of FreeBSD...

```
root@paranoia:/usr/local/etc/rc.d # uname -a
FreeBSD paranoia 10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 15:26:37 UTC 2015  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

After following the guide, I had problems after installing MySQL 5.6 and trying to set the root password with...

```
mysql> UPDATE mysql.USER SET Password=PASSWORD('password');
ERROR 1146 (42S02): Table 'mysql.USER' doesn't exist
```

Why won't it let me set the root password?

Thanking you in advance,
Jonathan.


----------



## ds_aim (Sep 22, 2015)

Use a clean freebsdFreeBSD.

Then :
`pkg update`

Then :
`pkg install mysql56-server`
Y to confirm.

Then set user mysql:

```
mysql -u root

GRANT ALL PRIVILEGES ON *.* TO root@"%"
IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH PRIVILEGES;
```


----------



## Johnny2Bad (Sep 22, 2015)

System trips up at....


```
mysql -u root

with...
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
```

Anymore help would be much appreciated.

Peace,
Jono.


----------



## SirDice (Sep 22, 2015)

As this is a new installation:

```
service mysql-server stop
rm -rf /var/lib/mysql/*
service mysql-server start
```


----------



## Johnny2Bad (Sep 22, 2015)

The above procedure fails when I reach....


```
rm -rf /var/lib/mysql/*
rm: No match.
```

and upon further investigation....

```
cd /var/lib/mysql
/var/lib/mysql: No such file or directory.
```

Any suggestions would be appreciated.

Peace,
Jonathan.


----------



## SirDice (Sep 22, 2015)

Oops, sorry, have been working with Linux too much lately. It should be /var/db/mysql/.


----------



## Johnny2Bad (Sep 22, 2015)

Thanks, so now I'm up to.....
`mysql -u root`

```
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
```

Any ideas to get around this one?

Peace,
Jonathan.


----------



## ds_aim (Sep 23, 2015)

Johnny2Bad said:


> Thanks, so now I'm up to.....
> `mysql -u root`
> 
> ```
> ...


Whatssssssssssssss sooo hard?


Just use a CLEANNNNNNNN    FreeBSD.
CLEAN.

And follow my steps below.


----------



## SirDice (Sep 23, 2015)

Johnny2Bad said:


> Thanks, so now I'm up to.....
> `mysql -u root`
> 
> ```
> ...


Yes, MySQL isn't running. You need to start it.


----------



## ds_aim (Sep 23, 2015)

A


SirDice said:


> Yes, MySQL isn't running. You need to start it.


After installing add in /etc/rc.conf this line: mysql_enable="YES"
Then start: `service mysql-server start`


----------



## Johnny2Bad (Oct 1, 2015)

I didn't have to start with a clean install at all, I managed to get it running by removing the package then the mysql user and reinstalling the package. But thanks anyway for the guidance.


----------

