[root@fjgh ~]# service mysqld start Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql-5.5.62/data/fjgh.pid).
查看日志文件 /usr/local/mysql-5.5.62/data/fjgh.err
190520 9:06:34 [Note] Plugin 'FEDERATED' is disabled. 190520 9:06:34 InnoDB: The InnoDB memory heap is disabled 190520 9:06:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins 190520 9:06:34 InnoDB: Compressed tables use zlib 1.2.11 190520 9:06:34 InnoDB: Using Linux native AIO 190520 9:06:34 InnoDB: Initializing buffer pool, size = 128.0M 190520 9:06:34 InnoDB: Completed initialization of buffer pool 190520 9:06:34 InnoDB: highest supported file format is Barracuda. 190520 9:06:34 InnoDB: Waiting for the background threads to start 190520 9:06:35 InnoDB: 5.5.62 started; log sequence number 1595675 190520 9:06:35 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 190520 9:06:35 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 190520 9:06:35 [Note] Server socket created on IP: '0.0.0.0'. 190520 9:06:35 [ERROR] Can't start server : Bind on unix socket: Permission denied 190520 9:06:35 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ? 190520 9:06:35 [ERROR] Aborting
注意 Can't start server : Bind on unix socket: Permission denied
发现 /var/lib/mysql 目录下并没有生成mysql.sock 预计是权限问题
于是修改
[root@fjgh ~]# chmod 777 /var/lib/mysql [root@fjgh ~]# service mysqld start Starting MySQL.. SUCCESS!
启动成功
突然又发现 mysql -v 执行出错
[root@fjgh bin]# mysql -v
-bash: msysql: command not found
查看环境变量配置
[root@fjgh bin]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/java/jdk1.8.0_212/bin:/root/bin:/usr/local/mysql-5.5.60/bin
发现配置的mysql的bin目录不对,应该是 /usr/local/mysql-5.5.62/bin
修改,刷新配置即可
[root@fjgh bin]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/java/jdk1.8.0_212/bin:/root/bin:/usr/local/mysql-5.5.60/bin [root@fjgh bin]# source ~/.bash_profile [root@fjgh bin]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/java/jdk1.8.0_212/bin:/root/bin:/usr/local/mysql-5.5.60/bin:/root/bin:/usr/local/mysql-5.5.62/bin