1

I am facing a long lasting issue on this command

  • bin/magento setup:upgrade

I have made an extension hello world on magento2 stable version, which will simply print hello world on screen.

The thing is when I ran that....it gave me setup version, not specified error (though I have specified)...then I searched & ran this command -

bin/magento setup:upgrade

When I ran above command then I met with another error....pdo_mysql is not installed....

Then I solved that error with the following commands: sudo apt-get install php5-mysql sudo apt-get install pdo-mysql

then by doing php -m I could see the pdo_mysql in extensions list :)

But then as ran that command (bin/magento setup:upgrade) again....I got another error (very frustrated). Please check the attachment.

For solving that error I referred this one.... https://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq

I typed this: sudo find / -type s so I got the list in that one of the line is like this...... /opt/lampp/var/mysql/mysql.sock

now in that article, it says......"Once you find where the socket is being opened, add or edit the line to your /etc/my.cnf file with the path to the socket file".........so I opened /etc/my.cnf but....I found that the line is already there.....socket = /opt/lampp/var/mysql/mysql.sock

Then it says to run this : kill -9 4969 or pkill -9 mysqld but I did not run...I am afraid it can cause damage to xampp...

Then it says....."After you do this you might want to look for a pid file in /var/run/mysqld/ and delete it" but the thing is I can not find mysqld folder inside var/run/ so I am confused what to do now....

Many times I restarted xampp by first stopping apache like this: sudo /etc/init.d/apache2 stop

But could not resolve the issue...

Can anyone please give the correct solution?

Magento 2 becomes a big problem running in Ubuntu for me :)

enter image description here

2

search mysqld.sock you can search it using command : find -name "mysqld.sock" then right click on it and copy link then paste it under /var/run/mysqld/ and rename it to mysqld.sock if there is no directory name "mysqld" in /var/run/ then create it

  • Hi Santosh, Thanks for your reply :) Now the thing is.....till now I already hit many commands so now if I fire this command...."sudo service apache2 start" it is not getting started....it is saying....AH00558: apache2: Could not reliably...bla bla bla.... :) so I hit this command....sudo apt-get upgrade php-mysql....it took 2 3 hours :( & finally done with a few errors (very less though but with errors) & when I hit find -name "mysqld.sock".....after printing 4 5 lines it was hanged up...very frustrated...but your solution looks close so will definitely come back to you :) – KA9 Dec 24 '15 at 6:30
  • Hi Santosh, me tried hitting your given command like this : nteam@nteam-System-Product-Name:~$ find -name "mysqld.sock" but outcome coming like following : find: ./.dbus': Permission denied find: ./.gvfs': Permission denied find: `./.cache/dconf': Permission denied Any idea what to do now? as no specific path coming. – KA9 Dec 29 '15 at 13:28
  • run command su and then enter root password,then after run same command.. – Santosh Kumar Dec 30 '15 at 17:39
  • Hi Santosh, I have fired the command like this..... nteam@nteam-System-Product-Name:/$ sudo find -name "mysqld.sock" It searched for 5 to 10 mins. but returned with no result :( so whole thing looked like this :- nteam@nteam-System-Product-Name:/$ sudo find -name "mysqld.sock" [sudo] password for nteam: nteam@nteam-System-Product-Name:/$ – KA9 Dec 31 '15 at 9:14
2

The answer given by Santosh Kumar & Denish Vachhani is absolutely right so I again say thank you to both of them :)

Now the thing is Santosh Kumar said search for mysqld.sock file using this command : find -name "mysqld.sock" I did it but no result found so it was unclear that how & from where can I have mysqld.sock file.

So finally what I did is :-

Before doing the following procedure please give your entire magento directory & sub directories & files the permission - 777 (in case of local or development phase)

Me gone to opt/lampp/var/mysql & looked for mysql.sock (remember that there wasn't available mysqld.sock file in my case) then I right clicked on it & selected "Make Link" so another file created from mysql.sock file so just renamed it to mysqld.sock & moved it (cut paste) to (outside opt folder)var/run/mysqld/ folder. If you don't find mysqld folder then simply create it. Remember that file should be having 777 permission.

Then go to your magento folder in terminal & hit this command :- sudo php bin/magento setup:upgrade & you will get success :)

Then visit your module from url & it will work :)

One note :- If you don't have mysqld directory in (outside opt folder)var/run then if you are not interested in making manually then here are the commands:

sudo mkdir /var/run/mysqld (this will make directory)

sudo mv /opt/lampp/var/mysql/mysqld.sock /var/run/mysqld (this will move your created mysqld.sock file to var/run/mysqld)

this command from your magento folder in terminal - sudo php bin/magento setup:upgrade

Few more tips :- 1) If you want to see how many commands you can hit then do this :- Go to your magento folder in terminal then,

cd bin ./magento You will have a list of commands :)

2) If you want to reindex then, go to your magento folder in terminal then hit these commands :-

cd bin ./magento indexer:reindex

3) If you want to compile then, go to your magento folder in terminal then hit these commands :-

cd bin ./magento setup:di:compile

Thank you & Good Luck

1

please clear page_cache, view_process and di folder.

please give sudo chmod -R 777 to root folder magento.

re-run compiler. using php -f bin/magento setup:di:compile

and also give chmod 777 '/var/run/mysqld/mysqld.sock

Note:- give full permission to magento root folder as well as mysqld.

  • Hi Denish, Thank you for your answer :) I am giving it a try right now & coming back to you. – KA9 Dec 23 '15 at 11:17
  • Hi Denish, when I hit this command - php -f bin/...... then the following error coming..... PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212+lfs/pdo_mysql.so' - /usr/lib/php5/20121212+lfs/pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212+lfs/pdo_mysqli.so' - /usr/lib/php5/20121212+lfs/pdo_mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Module 'PDO' already loaded in Unknown on line 0 then... – KA9 Dec 23 '15 at 11:37
  • then compilation process started...then....it gave another error....Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH' – KA9 Dec 23 '15 at 11:37
  • 1
    if pdo error re generated please try sudo apt-get install php5-mcrypt sudo apt-get install php5-mysql and please specify MCRYPT_BLOWFISH is your module name? than check code manually. – denish vachhani Dec 23 '15 at 11:42
  • Hi Denish, nope...my extension/module name is Magento_Hello, ok yes so giving try to install mcrypt...& coming back. Thanks :) – KA9 Dec 23 '15 at 11:48
1

In my case, the reason is I run the script "bin/magento setup:upgrade" under "root" account.

Need to switch to this account, and everything works fine:

enter image description here

0

give chmod -R 777 /var/pub/app

This is due to the permission issue

  • Hi Ayush, thanks for you reply :) yes I am giving it a try & coming back to you....but I should inform you that I am getting an error in compilation of Mcrypt as I mentioned above :) – KA9 Dec 23 '15 at 11:40
  • Hi Ayush, I could not find var/pub directory? where is it? in magento2 root folder var/pub? or in lampp? – KA9 Dec 23 '15 at 11:43
  • yes pub in the magento root folder – Ayush Mittal Dec 23 '15 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.