Can't access MySQL through XAMPP and phpMyAdmin

狂风中的少年 提交于 2019-12-20 10:32:02

问题


I am using XAMPP and I am trying to access phpMyAdmin through http://localhost/phpmyadmin, but I'm getting this error message:

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).

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

回答1:


Following line in the log is the reason:

"Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored"

As Rishi Kalia has pointed out already you have to set the correct permissions:

  1. Open Terminal
  2. Navigate to the XAMPP config folder

    cd /Applications/XAMPP/xamppfiles/etc/

  3. Set permissions of my.cnf to 600

    sudo chmod 600 my.cnf

  4. Restart MySQL.




回答2:


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.

However after I changed the permission I got : 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

  • The Terminal is in Applications/Utilities/Terminal

2. Navigate to the XAMPP config folder

  • pwd shows the path listing to the current directory

  • cd changes the current directory

  • ls -a lists all the files in that directory

Enter this code into the terminal: cd /Applications/XAMPP/xamppfiles/etc/

3. Set permissions of my.cnf to 600

Enter this code into the terminal: sudo chmod 600 my.cnf

4. Restart MySQL

Voilà!




回答3:


you have to go to your xampp installation directory and change the permissions of my.cnf to 600




回答4:


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.

http://veerasundar.com/blog/2009/07/how-to-change-xampp-server-port/




回答5:


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".

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...").

Hope this helps!




回答6:


Pretty simple... once you take ownership of xamppfiles, you also need to update my.cnf file in the xamppfiles/etc/ directory.

Default MySQL password is mysql.

Once you authorized httpd service to run as User yourusername (OS X) Group yourgroup(id).

Open terminal and type in sudo whoami, this will tell you. In the my.cnf file, replace mysql with your user name.

Restart Apache.

Your username.pid file will be automatically updated.



来源:https://stackoverflow.com/questions/13096617/cant-access-mysql-through-xampp-and-phpmyadmin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!