登录
首页 >  数据库 >  MySQL

运行 mysql 遇到的两个报错

来源:SegmentFault

时间:2023-01-26 09:39:25 492浏览 收藏

大家好,今天本人给大家带来文章《运行 mysql 遇到的两个报错》,文中内容主要涉及到MySQL,如果你对数据库方面的知识点感兴趣,那就请各位朋友继续看下去吧~希望能真正帮到你们,谢谢!

数据库- mysql

mac 安装 mysql

mac 运行 mysql

想要启动 mysql,我在安装完 mysql 之后执行

mysqld start

结果报错了

mysqld: Can't change dir to '/usr/local/mysql-5.7.22-macos10.13-x86_64/data/' (Errcode: 13 - Permission denied)
2018-05-08T01:55:59.265832Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-08T01:55:59.267290Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-08T01:55:59.268500Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 53823 ...
2018-05-08T01:55:59.283628Z 0 [Warning] Can't create test file /usr/local/mysql-5.7.22-macos10.13-x86_64/data/wuxiaolandeMacBook-Pro.lower-test
2018-05-08T01:55:59.283686Z 0 [Warning] Can't create test file /usr/local/mysql-5.7.22-macos10.13-x86_64/data/wuxiaolandeMacBook-Pro.lower-test
2018-05-08T01:55:59.284156Z 0 [ERROR] failed to set datadir to /usr/local/mysql-5.7.22-macos10.13-x86_64/data/
2018-05-08T01:55:59.284180Z 0 [ERROR] Aborting

2018-05-08T01:55:59.284607Z 0 [Note] Binlog end
2018-05-08T01:55:59.286964Z 0 [Note] mysqld: Shutdown complete

这里的关键词是

 permission denied

我问了朋友安刚,他说让我把命令改成
 sudo mysqld start
,
我执行这个命令,
然后遇到了第二个报错

2018-05-08T02:00:43.749692Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-08T02:00:43.750435Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-08T02:00:43.751253Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 53972 ...
2018-05-08T02:00:43.761169Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.7.22-macos10.13-x86_64/data/ is case insensitive
2018-05-08T02:00:43.761244Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2018-05-08T02:00:43.761267Z 0 [ERROR] Aborting

2018-05-08T02:00:43.761314Z 0 [Note] Binlog end
2018-05-08T02:00:43.765076Z 0 [Note] mysqld: Shutdown complete

我查了下,第二个报错(关键词Security)是因为

这是因为在测试的时候,使用root来启动的。而从安全角度来讲,不建议用root用户启动。

我按照安刚给我的建议,修改下目录权限
执行

sudo chown -R wxl /usr/local/mysql-5.7.22-macos10.13-x86_64/data/

今天带大家了解了MySQL的相关知识,希望对你有所帮助;关于数据库的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>