无法通过 XAMPP 和 phpMyAdmin 访问 MySQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13096617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't access MySQL through XAMPP and phpMyAdmin
提问by MillerMedia
I am using XAMPP and I am trying to access phpMyAdmin through http://localhost/phpmyadmin
, but I'm getting this error message:
我正在使用 XAMPP 并尝试通过 访问 phpMyAdmin http://localhost/phpmyadmin
,但我收到此错误消息:
Error
SQL query:
SHOW PLUGINS
MySQL said:
#1 - Can't create/write to file '/var/folders/_y/gtpc137d1q9gkvsj0dsxjd040000gn/T/#sql9f2_8_0.MYI' (Errcode: 13)
I haven't tried to access it in a while so I don't know what has changed since the last time. Can anyone shed light on this for me? I've Googled and can't seem to understand what most people are talking about in related issues.
我有一段时间没有尝试访问它,所以我不知道自上次以来发生了什么变化。任何人都可以为我阐明这一点吗?我在谷歌上搜索过,似乎无法理解大多数人在相关问题中谈论的内容。
Also, my XAMPP won't connect to Apache anymore either (it just keeps giving me the loading image).
此外,我的 XAMPP 也不会再连接到 Apache(它只是不断给我加载图像)。
Here is the error I'm getting:
这是我得到的错误:
121201 22:59:27 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored
121201 22:59:28 [Warning] Setting lower_case_table_names=2 because file system for /Applications/XAMPP/xamppfiles/var/mysql/ is case insensitive
121201 22:59:28 [Note] Plugin 'FEDERATED' is disabled. /Applications/XAMPP/xamppfiles/sbin/mysqld: Can't create/write to file '/var/folders/_y/gtpc137d1q9gkvsj0dsxjd040000gn/T/ibCVKOvf' (Errcode: 13)
121201 22:59:28 InnoDB: Error: unable to create temporary file; errno: 13
121201 22:59:28 [ERROR] Plugin 'InnoDB' init function returned error.
121201 22:59:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121201 22:59:29 [Note] Event Scheduler: Loaded 0 events
121201 22:59:29 [Note] /Applications/XAMPP/xamppfiles/sbin/mysqld: ready for connections.
Version: '5.1.44' socket: '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' port: 3306 Source distribution
回答by david
Following line in the log is the reason:
日志中的以下行是原因:
"Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored"
“警告:世界可写配置文件‘/Applications/XAMPP/xamppfiles/etc/my.cnf’被忽略”
As Rishi Kalia has pointed out already you have to set the correct permissions:
正如 Rishi Kalia 已经指出的那样,您必须设置正确的权限:
- Open Terminal
Navigate to the XAMPP config folder
cd /Applications/XAMPP/xamppfiles/etc/
Set permissions of
my.cnf
to600
sudo chmod 600 my.cnf
Restart MySQL.
- 打开终端
导航到 XAMPP 配置文件夹
cd /Applications/XAMPP/xamppfiles/etc/
的设置权限
my.cnf
来600
须藤 chmod 600 my.cnf
重启 MySQL。
回答by Renee Rose-Perry
I had to reset the permissions in my xampp folder because I needed to be able to INSERT images into a folder in the htdocs, via php from website I am building.
我必须在我的 xampp 文件夹中重置权限,因为我需要能够通过我正在构建的网站中的 php 将图像插入到 htdocs 中的文件夹中。
However after I changed the permission I got : Errcode: 13
但是,在我更改了权限后,我得到了:Errcode: 13
The process listed above works but I am adding some additional notes for people who have no clue how to use the terminal.
上面列出的过程有效,但我正在为不知道如何使用终端的人添加一些额外的注释。
1. Open Terminal
1. 打开终端
- The Terminal is in Applications/Utilities/Terminal
- 终端在 应用程序/实用程序/终端中
2. Navigate to the XAMPP config folder
2. 导航到 XAMPP 配置文件夹
pwdshows the path listing to the current directory
cdchanges the current directory
ls -alists all the files in that directory
pwd显示当前目录的路径列表
cd改变当前目录
ls -a列出该目录下的所有文件
Enter this code into the terminal: cd /Applications/XAMPP/xamppfiles/etc/
将此代码输入终端: cd /Applications/XAMPP/xamppfiles/etc/
3. Set permissions of my.cnf to 600
3.设置my.cnf的权限为600
Enter this code into the terminal: sudo chmod 600 my.cnf
将此代码输入终端: sudo chmod 600 my.cnf
4. Restart MySQL
4. 重启 MySQL
Voilà!
瞧!
回答by 000
you have to go to your xampp installation directory and change the permissions of my.cnf
to 600
你必须去你的xampp安装目录并将权限更改my.cnf
为600
回答by Chamath
Sometimes you might have installed an application or a server which accesses the same port which is used by XAMPP. Try changing the port for the XAMPP server. Following link will help you.
有时,您可能安装了访问 XAMPP 使用的相同端口的应用程序或服务器。尝试更改 XAMPP 服务器的端口。以下链接将为您提供帮助。
http://veerasundar.com/blog/2009/07/how-to-change-xampp-server-port/
http://veerasundar.com/blog/2009/07/how-to-change-xampp-server-port/
回答by Jimmy Adaro
If you changed the write and read permissions in all the enclosed items inside the XAMPP main folder("/Applications/XAMPP"), be sure to make this folder Readable and Writable for everyone: "/Applications/XAMPP/xamppfiles/var/mysql".
如果您更改了 XAMPP 主文件夹(“/Applications/XAMPP”)内所有封闭项目的读写权限,请确保将此文件夹设置为对所有人可读和可写:“/Applications/XAMPP/xamppfiles/var/mysql ”。
This can be done accessing to that folder from the Finder and then Get Info (Cmd + I), in the "Sharing & Permissions" click the lock icon, type your password and change "everyone - read only" to "everyone - read & write", and be sure to make that change for all the enclosed items as well (clicking the gear icon and then "Apply to enclosed items...").
这可以通过从 Finder 访问该文件夹然后获取信息(Cmd + I),在“共享和权限”中单击锁定图标,输入您的密码并将“所有人 - 只读”更改为“所有人 - 阅读&”来完成写”,并确保也对所有随附的项目进行更改(单击齿轮图标,然后单击“应用于随附的项目...”)。
Hope this helps!
希望这可以帮助!
回答by user5042118
Pretty simple... once you take ownership of xamppfiles, you also need to update my.cnf file in the xamppfiles/etc/ directory.
非常简单……一旦您获得了 xamppfiles 的所有权,您还需要更新 xamppfiles/etc/ 目录中的 my.cnf 文件。
Default MySQL password is mysql
.
默认 MySQL 密码是mysql
.
Once you authorized httpd service to run as User yourusername (OS X) Group yourgroup(id).
一旦您授权 httpd 服务以用户您的用户名 (OS X) 组 yourgroup(id) 身份运行。
Open terminal and type in sudo whoami, this will tell you. In the my.cnf file, replace mysql
with your user name.
打开终端并输入 sudo whoami,这会告诉你。在 my.cnf 文件中,替换mysql
为您的用户名。
Restart Apache.
重新启动阿帕奇。
Your username.pid file will be automatically updated.
您的 username.pid 文件将自动更新。