linux mysql服务不可用

linux mysql服务不可用,第1张

可能是/usr/local/mysql/data/rekfan.pid文件没有写的权限

解决方法 :给予权限,执行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data”  然后重新启动mysqld!

2.可能进程里已经存在mysql进程

解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9  进程号”杀死,然后重新启动mysqld!

3.可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。

解决方法:去mysql的数据目录/data看看,如果存在mysql-bin.index,把它删除掉

Linu下启动MySQL结果显示:env: /etc/init.d/mysql: 是脚本执行的问题

解决办法:依次执行下面的命令(执行失败的话,检查路径是否正确):

cp /etc/init.d/mysql /etc/init.d/mysql.bak    #拷贝/etc/init.d/mysql到/etc/init.d/mysql.bak文件

/etc/init.d/mysql.bak start   #执行/etc/init.d/mysql.bak文件启动mysql  成功!!!

rm /etc/init.d/mysql           #删除/etc/init.d/mysql文件

mv /etc/init.d/mysql.bak /etc/init.d/mysql  #将/etc/init.d/mysql.bak重命名为/etc/init.d/mysql

5./etc/init.d/mysql start         #执行/etc/init.d/mysql 启动mysql   成功!

如上述方法不能解决可尝试:

你在光盘里找一下 ls mysql*

应该是有一个叫mysql-server*的文件,重装这个文件试试

[root@centos5 ~]# service mysqld start

mysqld: 未被识别的服务

这里应该表示你的系统未有这个服务,得检查你的软件安装是否正确。

用YUM吧 yum -y install mysql mysql-server mysql-connector-odbc mysql-devel libdbi-

dbd-mysql

hi 楼主,在数据库中创建包含很多,视图,索引,临时表的创建权限都能分开赋予,你可以执行 show privileges 来查看权限参数,我这边就以创建表为例,只包含查询表功能,其他修改,删除,备份没有权限;以下是步骤:

1,create user 'tom'@'%' identified by '123456'---创建用户,无权限;

2, grant create,select on wangxh2.* to tom-----把wangxh2库的所有表的创建和查询赋予tom

3,flush privileges-----刷新权限表才能起效

接下来是测试:

mysql>show databases

+--------------------+

| Database |

+--------------------+

| information_schema |

| test |

| wangxh2|

+--------------------+

3 rows in set (0.06 sec)

mysql>use wangxh2

Database changed

mysql>show tables

+-------------------+

| Tables_in_wangxh2 |

+-------------------+

| test |

+-------------------+

1 row in set (0.00 sec)

mysql>drop test

ERROR 1064 (42000): You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'test' at line 1

mysql>drop table test

ERROR 1142 (42000): DROP command denied to user 'tom'@'localhost' for table 'test'

mysql>select count(*) from test

+----------+

| count(*) |

+----------+

| 33554432 |

+----------+

1 row in set (0.01 sec)

mysql>insert into test values(1)

ERROR 1142 (42000): INSERT command denied to user 'tom'@'localhost' for table 'test'

mysql>delete from test

ERROR 1142 (42000): DELETE command denied to user 'tom'@'localhost' for table 'test'

mysql>update test set id=1

ERROR 1142 (42000): UPDATE command denied to user 'tom'@'localhost' for table 'test'

mysql>create table test1 (id int)

Query OK, 0 rows affected (0.02 sec)

mysql>insert into test1 values(1)

ERROR 1142 (42000): INSERT command denied to user 'tom'@'localhost' for table 'test1'

[mysql@localhost ~]$ mysqldump -u tom -paidengshan wangxh2 >/home/mysql/aa.sql

mysqldump: Got error: 1044: Access denied for user 'tom'@'%' to database 'wangxh2' when using LOCK TABLES

[mysql@localhost ~]$

-----------------------------------------------------------------------------------------

以上测试发现,tom对wangxh2有建表,查询表的权限,但是修改,删除,新增,备份都没有权限,达到你的需求了


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8748965.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-20
下一篇2023-04-20

发表评论

登录后才能评论

评论列表(0条)

    保存