# MySQL error 2002 / Cant start the service



## D4rkCons0le (Sep 30, 2016)

hey,
i Installed a MySQL 5.6


```
cd /usr/ports/databases/mysql56-server/
make WITH_XCHARSET=all install clean
```

i changed in the etc/rc.conf to

```
mysql_enable="YES"
```

i tried to do:

```
service mysql-server start
Starting MySQL...
```

and when i did

```
service mysql-server status
mysql is not running.
```

I have the this error too:

```
mysql error 2002 can't connect to local mysql server through socket '/var/lib/mysql/mysql.sock' (2)
```

Error log:

```
160930 20:48:05 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2016-09-30 20:48:05 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-30 20:48:05 0 [Note] /usr/local/libexec/mysqld (mysqld 5.6.33) starting as process 1295 ...
2016-09-30 20:48:05 1295 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2016-09-30 20:48:05 1295 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-09-30 20:48:05 1295 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-09-30 20:48:05 1295 [Note] InnoDB: The InnoDB memory heap is disabled
2016-09-30 20:48:05 1295 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-09-30 20:48:05 1295 [Note] InnoDB: Memory barrier is not used
2016-09-30 20:48:05 1295 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-09-30 20:48:05 1295 [Note] InnoDB: Not using CPU crc32 instructions
2016-09-30 20:48:05 1295 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-09-30 20:48:05 1295 [Note] InnoDB: Completed initialization of buffer pool
2016-09-30 20:48:05 1295 [Note] InnoDB: Highest supported file format is Barracuda.
2016-09-30 20:48:05 1295 [Note] InnoDB: Log scan progressed past the checkpoint lsn 1595916
2016-09-30 20:48:05 1295 [Note] InnoDB: Database was not shutdown normally!
2016-09-30 20:48:05 1295 [Note] InnoDB: Starting crash recovery.
2016-09-30 20:48:05 1295 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-09-30 20:48:05 1295 [Note] InnoDB: Restoring possible half-written data pages 
2016-09-30 20:48:05 1295 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1600309
2016-09-30 20:48:05 1295 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 17 18 19 20 21 22 23 24 25 26 27 28 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
2016-09-30 20:48:06 1295 [Note] InnoDB: 128 rollback segment(s) are active.
2016-09-30 20:48:06 1295 [Note] InnoDB: Waiting for purge to start
2016-09-30 20:48:06 1295 [Note] InnoDB: 5.6.33 started; log sequence number 1600309
2016-09-30 20:48:06 1295 [Note] Server hostname (bind-address): '*'; port: 3306
2016-09-30 20:48:06 1295 [Note] IPv6 is available.
2016-09-30 20:48:06 1295 [Note]   - '::' resolves to '::';
2016-09-30 20:48:06 1295 [Note] Server socket created on IP: '::'.
2016-09-30 20:48:06 1295 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/user.frm' (errno: 13 - Permission denied)
2016-09-30 20:48:06 1295 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/user.frm' (errno: 13 - Permission denied)
160930 20:48:06 mysqld_safe mysqld from pid file /var/db/mysql/XXXX.pid ended
```

Please help me! Thanks you


----------



## SirDice (Oct 3, 2016)

Did you upgrade from an older MySQL version?


```
2016-09-30 20:48:05 1295 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
```


----------

