I get this error when starting mysql via ssh on my ec2 ami linux instance:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/libysql/mysql.sock' (2)
Before running "mysql" command i tried to start mysql service:
sudo service mysqld start
but fails.
I checked for mysql.sock in the specified directory but it was missing. What is going on?
EDIT
Also i changed permissions to these directories:
/var/lib/mysql/ => 755
all sub-directories in /var/lib/mysql => 700
all files in /var/lib/mysql => 660
EDIT
I just uninstalled and re-installed mysql on my redhat ami ec2 instance. And I still can't start mysql service.
EDIT
Here is my mysql log:
170506 04:31:30 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
2017-05-06 04:31:30 6516 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/libexec/mysql56/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2017-05-06 04:31:30 6516 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-05-06 04:31:30 6516 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-06 04:31:30 6516 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-06 04:31:30 6516 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-06 04:31:30 6516 [Note] InnoDB: Memory barrier is not used
2017-05-06 04:31:30 6516 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-05-06 04:31:30 6516 [Note] InnoDB: Using Linux native AIO
2017-05-06 04:31:30 6516 [Note] InnoDB: Using CPU crc32 instructions
^G/usr/libexec/mysql56/mysqld: Can't create/write to file '/var/tmp/ibdSw66G' (Errcode: 13 - Permission denied)
2017-05-06 04:31:30 7faa567fd840 InnoDB: Error: unable to create temporary file; errno: 13
2017-05-06 04:31:30 6516 [ERROR] Plugin 'InnoDB' init function returned error.
2017-05-06 04:31:30 6516 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-05-06 04:31:30 6516 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-05-06 04:31:30 6516 [ERROR] Aborting
2017-05-06 04:31:30 6516 [Note] Binlog end
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'partition'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'ARCHIVE'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_METRICS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_CMP'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'INNODB_TRX'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'BLACKHOLE'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'CSV'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'MEMORY'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'MyISAM'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'MRG_MYISAM'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'sha256_password'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'mysql_old_password'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'mysql_native_password'
2017-05-06 04:31:30 6516 [Note] Shutting down plugin 'binlog'
2017-05-06 04:31:30 6516 [Note] /usr/libexec/mysql56/mysqld: Shutdown complete
EDIT
I also fully uinstalled and re-installed mysql with this command couple of times now:
sudo yum -y remove mysql-server
sudo yum -y install mysql-server
EDIT
Alright, forget it…lol. I just started a new amz ec2 linux instance. THanks!
Best Answer
Try
chown mysql.mysql /var/lib/mysql/ -R; chmod 1777 /var/tmp
Also, have you read/tried this: