Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql.sock error on local development machine #88

Closed
mikebranderhorst opened this issue Sep 23, 2012 · 3 comments
Closed

mysql.sock error on local development machine #88

mikebranderhorst opened this issue Sep 23, 2012 · 3 comments

Comments

@mikebranderhorst
Copy link

I had a socket error using dev/shell/log.php (not using front- and backend)
After some research I found out there are more developers with this problem.
Solution for me was app/etc/local.xml host from localhost to 127.0.0.1

<host><![CDATA[127.0.0.1]]></host>

Or leaving it empty:

<host><![CDATA[]]></host>

Or by adding unix socket:

<unix_socket><![CDATA[/path/to/mysql.sock]]></unix_socket>

I think the last two are not preferred because of: version control, deploy, production etc.

But the first method should at least be mentioned.

<host><![CDATA[localhost]]></host><!-- use 127.0.0.1 when having error 2002 on connecting db -->
@magento-team
Copy link
Contributor

Hi Mike,
thanks for the proposal.

Can you, please, clarify how you were able to install Magento application with localhost DB, if the localhost is not resolved by your operating system?

@magento-team
Copy link
Contributor

Hi Mike,

haven't heard anything from you for two weeks already.

We have approved the proposal as following:

  • documented the config file content in the Magento documentation. It will be shipped with the application.
  • described the config file nodes inside the file itself in order to provide short documentation for developers right in place. The changes will be published here at GitHub with one of the next updates.

Closing the ticket. Thank you.

magento-team added a commit that referenced this issue Nov 12, 2012
* Framework changes
  * Added dependency injection of framework capability
    * Adopted Zend\Di component of Zend Framework 2 library
    * Implemented object manager in Magento application
    * Refactored multiple base classes to dependency injection principle (dependencies are declared in constructor)
  * Themes/View
    * Implemented storing themes registry in database, basic CRUD of themes, automatic registration of themes in database from file system out of the box
    * Renamed `Mage_Core_Model_Layout_Update` into `Mage_Core_Model_Layout_Merge`, the former becomes an entity domain model. Similar changes with `Mage_Core_Model_Resource_Layout` -> `Mage_Core_Model_Resource_Layout_Update`, `Mage_Core_Model_Layout_Data` -> `Mage_Core_Model_Layout_Update`
* Performance tests
  * Improved indexers running script `dev/shell/indexer.php` to return appropriate exit code upon success/failure
  * Implemented running the same performance scenario file with different parameters
  * Slightly refactored framework class `Magento_Performance_Testsuite_Optimizer` for better visibility of algorithm
* Visual design editor
  * Added ability to remove elements in editor UI
  * Revised history of changes VDE toolbar and algorithm of "compacting" operations (moving, removing elements) as a layout update XML
  * Added selection of themes to VDE launcher page
* Refactored JavaScript of some UI elements to jQuery:
  * "Simple" and "configurable" product view pages
  * "Create Account" page
  * "Shopping Cart" page
  * CAPTCHA
  * Newsletter subscription
* Tax management UX improvements
  * Split Basic and Advanced Settings for Tax Rule Management UI
  * Moved the Import/Export functionality to Tax Rate page
  * Moved Tax menu to System from Sales
* Implemented the editable multiselect JavaScript component
* Added mentioning sitemap in `robots.txt` after generation
* Removed creation of DB backup in integration testing framework
* Fixed logic of order of loading ACL resources in backend
* Fixed JavaScript error during installation when one of files in `pub/media` is not writable
* Fixed structure of legacy test fixtures that allowed ambiguous keys in declaration
* Fixed inability to restore admin password when CAPTCHA is enabled
* Various minor UX fixes (labels, buttons, redirects, etc...)
* GitHub requests:
  * [#59](#59) -- implemented handling of unexpected situations in admin/dashboard/tunnel action
  * [#66](#66)
    * refactored ImageMagick adapter unit test to avoid system operation
    * simplified unit testing framework -- removed unused classes, simplified handling logic of directory `dev/tests/unit/tmp` and removed it from VCS
  * [#73](#73), [#74](#74) -- fixes in docblock tags
  * [#75](#75), [#96](#96) -- fixed translation module contexts in a few places
  * [#80](#80) -- fixed some runtime errors in import/export module
  * [#81](#81) -- removed usage of "remove" directive in places where it is overridden by setting root template anyway
  * [#87](#87) -- changed paths of files to include from relative into absolute in `dev/shell/indexer.php` and `log.php`
  * [#88](#88) -- provided comments for values that can be configured in `app/etc/local.xml` file
  * [#90](#90) -- slightly optimized logic of implementation of loading configurable product attributes
magento-team pushed a commit that referenced this issue Feb 13, 2015
[Tango] S46 Controller Refactoring, Exceptions, Bug Fixes
magento-team pushed a commit that referenced this issue Nov 1, 2015
okorshenko pushed a commit that referenced this issue Jun 12, 2016
[Extensibility] Bug fixes - part 2
@LiamKarlMitchell
Copy link

PHP looks at a different default path for the unix socket location...
setup:upgrade and possibly other areas do not use what I have configured in the etc/env config!

    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'localhost',
                'dbname' => '...',
                'username' => '...',
                'password' => '...',
                'unix_socket' => '/var/run/mysqld/mysqld.sock',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8mb4;',
                'active' => '1'
            ]
        ]
    ],

It should use the unix_socket not the PHP default location of the socket.

https://stackoverflow.com/questions/36639014/got-error-while-installing-module-in-magento2-sqlstate-hy000-2000-no-such-f
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

Or configure php.ini to look for that as the socket.

pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock
mysql.default_socket = /var/run/mysqld/mysqld.sock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants