# MySQL connection error



## cooltomato (May 16, 2012)

Hi everybody,

I've just installed mysql-server and -client 5.1.50, when I try to start the mysql deamon, it shows errors and I checked the log file. This is it: 

```
rule91# mysqld_safe &
[1] 29090
rule91# 120516 22:29:48 mysqld_safe Logging to '/var/db/mysql/rule91.err'.
120516 22:29:48 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
120516 22:29:49 mysqld_safe mysqld from pid file /var/db/mysql/rule91.pid ended
[1]    Done                          mysqld_safe
```
The log is like this: 

```
rule91# tail /var/db/mysql/rule91.err
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 44233
120516 22:30:32  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
120516 22:30:32  InnoDB: Started; log sequence number 0 44233
120516 22:30:32 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120516 22:30:32 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
120516 22:30:32 mysqld_safe mysqld from pid file /var/db/mysql/rule91.pid ended
```

So I guess because of that error I can not connect to the database 

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

So how to deal with this problem people?
Please help me out as I'm quite new to this FreeBSD and Unix.

Cheers


----------



## SirDice (May 16, 2012)

Start it the proper way.

`# service mysql start`

Or

`# /usr/local/etc/rc.d/mysql start`


----------

