如果/etc//下面没有mysqld的话,service mysqld start也是不好使的,同样,chkconfig mysqld on也是不能用
解决办法:
将mysql的这个文件替换上去即可
首先到mysql的目录中,查找下
[root@test6_100 mysql]# find ./* -name
./support-files/
果然在这里,将这个文件添加到/etc//下,并且命名为mysqld即可
cp /usr/local/mysql/.support-files/ /etc//mysqld
重新启动
/etc//mysqld start
Starting MySQL........... SUCCESS!
但是启动后,查看进程都在,但是提示这个错误
mysql -uroot -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/' (2)
这个是因为/etc/文件中没有指定sock文件的位置造成的,这个简单,直接做一个软连接即可
[root@test6_100 ~]# ln -s /tmp/ /var/lib/mysql/
[root@test6_100 ~]# cd /var/lib/mysql/
[root@test6_100 mysql]# ll
total 0
lrwxrwxrwx 1 root root 15 Oct 24 03:21 -> /tmp//tmp/ /var/lib/mysql/
[root@test6_100 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
还有一种办法就是在没有这个mysqld的情况下,用mysql/bin下的文件来启动也是可以的
启动:
mysqld_safe --user=mysql &
后面的 & 一定要带上!!!!
停止:
mysqladmin -uroot -p[password] shutdown