MySQL: error on El Capitan OS after Yosemite OS update - mysql-error-1064

I have problems with MySQL on my MacBook. I had updated my OS from Yosemite to El Capitan before I installed MySQL server.
Now, when I try to run MySQL on Terminal, I got the error like this
ERROR! The server quit without updating PID file
Anyone can help me please? Thanks a lot!

Try updating your my.cnf file to set the location of the PID file manually. Here's how you do that.
In your Terminal run the following command.
ps -ax | grep mysql
This will list all the locations of the important mysql files. Look for the path of the --pid-file
I will look something like this:
--pid-file=/path/to/your/local/mysqld.local.pid
Copy the path of the mysqld.local.pid file
Next open your my.cnf file using nano
sudo nano /usr/local/mysql/my.cnf
Set the pid-file path at the end of your my.cnf file. Search for pid-file. If you can't find it, manually enter it at the end of your my.cnf file. This will tell mysql where to look for the PID file. Enter the path that you copied like the example below.
pid-file = /path/to/your/local/mysqld.local.pid
Close and save the file
Next restart mysql. You may need to do this twice to reset your PID error.
sudo /usr/local/mysql/support-files/mysql.server start
That should solve your problem! Good luck

I had to create the file my.cnf in /etc and add [mysqld] before the line pid-file = /path/to/your/local/mysqld.local.pid
Finally it worked!

Related

Torch / Lua after installation is not working

I have followed the following approach in order to install Torch in my machine (Mac).
http://torch.ch/docs/getting-started.html#_
When I am done with the installation, I type:
$ luarocks install image
or $ luarocks lis
or $th
in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?
If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.
To do this:
Navigate in your terminal to the root directory by running the command:
$ cd
Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:
$ emacs .bash_profile
Add the following line to the end of the file (replacing 'you' with your Mac username):
PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
Save and exit the text editor
Source the changes by running:
$ source .bash_profile
Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):
$ echo $PATH
To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again
Now try th and it should run Torch!
For more help on PATH:
https://kb.iu.edu/d/acar
The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.
Have you updated your PATH? It should include something like
/home/user/torch/install/bin
I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.
I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.

Patching macvim remote editing, file netrw.vim

So there's a problem with macvim when doing remote editing through
:e scp://path/to/file
Every time I try to save :w, macvim complains E382: Cannot write, 'buftype' option is set.
The quick fix to solving this is to do :set buftype:""
However, there are patches out there to solve the issue. So I downloaded a patch file to fix this problem. The problem is located in the netrw.vim file. When I try to patch the file netrw.vim through patch -p1 < file.patch, it gives me an error that says
patch: **** Can't rename file netrw.vim to netrw.vim.orig : Permission denied
I tried chmod for netrw.vim, but it doesn't let me.
Any help is appreciated!
p.s. I'm running on OSX 10.9.5
I just tried mvim scp://hostname/, picked a file, edited and changed it, and saved it. It worked.
I then tried mvim scp://hostname/somefile, edited and changed it, and saved it. It worked.
So, I suggest that you upgrade: you can find netrw v154b on http://www.drchip.org/astronaut/vim/index.html#NETRW .
btw, the mvim I used is v7.4.258 .
if you opened a remote directory and selected a file to edit you need create the tmp file in you local and set this command :set by=acwrite or :set buftype=acwrite and finally save your changes :w.

`pg_tblspc` missing after installation of latest version of OS X (Yosemite or El Capitan)

I use postgres from homebrew in my OS X, but when I reboot my system, sometimes the postgres doesn't start after the reboot, and so I manually tried to start it with postgres -D /usr/local/var/postgres, but then the error occurred with the following message: FATAL: could not open directory "pg_tblspc": No such file or directory.
The last time it occurred, I couldn't get it to the original state, so I decided to uninstall the whole postgres system and then re-installed it and created users, tables, datasets, etc... It was so disgusting, but it frequently occurs on my system, say once in a few months.
So why does it lose the pg_tblspc file frequently? And is there anything that I can do to avoid the loss of the file?
I haven't upgraded my homebrew and postgres to the latest version (i.e. I've been using the same version). Also, all the things that I did on the postgres database is delete the table and populate the new data every day. I haven't changed the user, password, etc...
EDIT (mbannert):
I felt the need to add this, since the thread is the top hit on google for this issue and for many the symptom is different. Homebrewers likely will encounter this error message:
No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
So, if you just experienced this after the Yosemite upgrade you now you're covered for now reading this thread.
Solved... in part.
Apparently, Installing the latest versions of OS X (e.g. Yosemite or El Capitan) removes some directories in /usr/local/var/postgres.
To fix this you simply recreate the missing directories:
mkdir -p /usr/local/var/postgres/pg_commit_ts
mkdir -p /usr/local/var/postgres/pg_dynshmem
mkdir -p /usr/local/var/postgres/pg_logical/mappings
mkdir -p /usr/local/var/postgres/pg_logical/snapshots
mkdir -p /usr/local/var/postgres/pg_replslot
mkdir -p /usr/local/var/postgres/pg_serial
mkdir -p /usr/local/var/postgres/pg_snapshots
mkdir -p /usr/local/var/postgres/pg_stat
mkdir -p /usr/local/var/postgres/pg_stat_tmp
mkdir -p /usr/local/var/postgres/pg_tblspc
mkdir -p /usr/local/var/postgres/pg_twophase
Or, more concisely (thanks to Nate):
mkdir -p /usr/local/var/postgres/{{pg_commit_ts,pg_dynshmem,pg_replslot,pg_serial,pg_snapshots,pg_stat,pg_stat_tmp,pg_tblspc,pg_twophase},pg_logical/{mappings,snapshots}}
Rerunning pg_ctl start -D /usr/local/var/postgres now starts the server normally and, at least for me, without any data loss.
UPDATE
On my system, some of those directories are empty even when Postgres is running. Maybe, as part of some "cleaning" operation, Yosemite removes any empty directories? In any case, I went ahead and created a '.keep' file in each directory to prevent future deletion.
touch /usr/local/var/postgres/{{pg_commit_ts,pg_dynshmem,pg_replslot,pg_serial,pg_snapshots,pg_stat,pg_stat_tmp,pg_tblspc,pg_twophase},pg_logical/{mappings,snapshots}}/.keep
Note: Creating the .keep file in those directories will create some noise in your logfile, but doesn't appear to negatively affect anything else.
Donavan's answer is spot on, I just wanted to add that as i did different things with the database (e.g. rake db:test), it went looking for different directories that haven't been mentioned above and would choke when they weren't present, in my case pg_logical/mappings, so you may want to setup a terminal running:
tail -f /usr/local/var/postgres/server.log
and watch it for missing folders while you go thru your typical database activities.
This is slightly off-topic but worth noting here as part of the PostgreSQL Yosemite recovery process. I had the same issue as above AND I had an issue with PostgreSQL "seemingly" running in the background so even after adding directories I couldn't restart. I tried using pg_ctl stop -m fast to kill the PostgreSQL server but no luck. I also tried going after the process directly with kill PID but as soon as I did that a PostgreSQL process re-appeared with a different PID.
The key ended up being a .plist file that Homebrew had loaded... The fix for me ended up being:
launchctl unload /Users/me/Library/LaunchAgents/homebrew.mxcl.postgresql92.plist
After that I was able to start PostgreSQL normally.
The missing directories need to be present in your PostgreSQL data directory. The default data directory is /usr/local/var/postgres/. If you have set up a different data directory, you need to re-create the missing directories there. If you modified the homebrew-recommended .plist file that starts PostgreSQL, you can find the data directory there:
cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
(it's the -D option you started postgres with:)
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/postgres</string>
<string>-D</string>
<string>/usr/local/pgsql/data</string>
In the example above, you'd create the missing directories in /usr/local/pgsql/data, like so:
cd /usr/local/pgsql/data
mkdir {pg_tblspc,pg_twophase,pg_stat,pg_stat_tmp,pg_replslot,pg_snapshots,pg_logical}
mkdir pg_logical/{snapshots,mappings}
I was having this issue with a dockerized Rails application.
Instead of pg_tblspc and other directories missing from /usr/local/var/postgres, they were missing from myRailsApp/tmp/db.
You will want to use a similar version of Donovan's solution, you will just have to alter to have the correct path for your Rails app...
mkdir /myRailsApp/tmp/db/{pg_tblspc,pg_twophase,pg_stat,pg_stat_tmp,pg_replslot,pg_snapshots}/
Also, you will want to add a .keep file to make sure git doesn't disregard the empty directories.
touch /myRailsApp/tmp/db/{pg_tblspc,pg_twophase,pg_stat,pg_stat_tmp,pg_replslot,pg_snapshots}/.keep
I noticed an error with a .keep in 1 of the directories, so just read the command line output carefully and adjust as needed.
Creating the missing directories certainly works but I fixed it by reinititializing postgres db, this is a cleaner approach to avoid future problems.
NOTE: This approach will delete existing databases
$ rm -r /usr/local/var/postgres
$ initdb -D /usr/local/var/postgres

sudo: ./install.sh: command not found is not working on Lion

I've been following this tutorial in order to get SimpleOpenNI installed on my mac but I keep getting stuck at installing the OpenNI and NITE components because it requires me to navigate to the folders in Terminal and then run "sudo ./install.sh". I do this and I get this error:
sudo: ./install.sh: command not found
I've installed Command Line Tools in Xcode and everything.
Thanks
The reason why that happens is because the script you are trying to execute needs the right permissions.
Type:
sudo chmod a+x install.sh
and then try again.
In directory of install.sh
prompt$ sh install.sh
first open Terminal, type cd and than drag the map into Terminal and press enter. Now type sudo ./install.sh and it will work. Took me very long to find out. Hope it helps.
.sh scripts should have "\n" line breaks.
"Command not found" also occurs if "\r\n" line breaks are used.
Well at least this is the case on FreeBSD.
You need to run VBoxLinuxAdditions.run as root, not autorun.sh
Once you've inserted the Guest Additions ISO, open Files and open the disc from the sidebar. Then, right-click in the background of the window where autorun.sh is and select
Open in > Terminal
Now you can run the following command to install the Guest Additions:
sudo ./VboxLinuxAdditions.run
I'm a newbie but here is an answer that may help with the sh problem...I am running Armbian on an orange pi prime H5 SBC and I had downloaded and unzipped arduino ide well after 2 hours of searching and trying I hit it ....open the directory where the file you want to open or install is ...now at the top of the directory open a terminal(under file it will say open a terminal here).now the sh filename.sh will work.

Where is PHP.ini in Mac OS X Lion?

I wanted to run some PHP right on my Mac, uncommented httpd.conf, activated web sharing, installed MySQL etc.
I can't seem to find my PHP files, most importantly, PHP.ini.
On my old machine it was located in /usr/local/php5/lib
But php5 directory doesn't exist in /usr/local..
Do I need to get a package or am I looking in the incorrect place?
Running OS X 10.7.3, PHP 5.3.8, Apache/2.2.21
To locate the ini file on your machine, open Terminal.app and run the following command:
php --ini
If you need a template for Lion, try this.
You should find it in /private/etc if it exists, otherwise:
sudo cp /private/etc/php.ini.default /private/etc/php.ini
In terminal do php -i | grep php.ini.
Should give you some clues ;)
Answers from #Cronk and #Justin got me close on Mac OS X 10.9 Mavericks. In fact, on my system the /etc/php.ini file was missing completely, and it wasn't until I ran phpinfo() on the web server that I observed there was no configuration file. Copying the file from /etc/php.ini.default and adding the fully qualified path to the mcrypt.so library to the config file solved the problem:
cp /etc/php.ini.default /etc/php.ini
Then in /etc/php.ini add the following line (using the correct path to your mcrypt.so file):
extension="/usr/local/Cellar/php54-mcrypt/5.4.29/mcrypt.so"
Then restart Apache2:
apachectl restart
As pointed out, the php --ini command will tell you where PHP is expecting to find the php.ini file.
For a standard installation, it's likely to be looking for /etc/php.ini
If you've used macports then PHP may be looking for /opt/local/etc/php5/php.ini
Run phpinfo() from any file and it tells you where it is. Here is a screenshot.
I have more than once instance of PHP running so the other answers did not work for me. This did:
Create a PHP file and open its local url in your browser:
<?php phpinfo(); ?>
The PHP.INI path will be listed close to the top.
1- Find .ini location path
Open Terminal and run command
php --ini
2- copy this path /usr/local/etc/php/7.4/php.ini
and open it by command
nano /usr/local/etc/php/7.4/php.ini
3- Make changes and Quit with the keyboard combination Ctrl+X to exit nano
4- run apachectl restart after finish
This is rather old thread, but I would like to add a further clarification.
If you have a system that has multiple PHP installations (like mine did) the results you get from using the command line tools MAY BE different than what is actually used by the web server. If you are interested in what PHP is being used by the web server, only use the information gathered from a web page that uses the 'phpinfo()' function.
For example, on my system the versions reported by the two different methods were:
Command line: 5.3.26
Web: 5.3.13
For the php.ini file path things were different, too:
Command line: /private/etc/php.ini
Web: /long/path/to/the/file/php.ini
You can find all the possible php.ini files using this:
find / -name php.ini 2>&1 | grep -v "denied" | grep -v "directory"
(the '2>&1' and 'grep' elements just restrict the output of the command to useful information, i.e. get rid of error messages)
On my system I found 3 INI files. Because I was interested in what the web server was using I knew that I should use the path returned from the web-page results. I made my changes to the php.ini file that was listed there, restarted apache, and re-ran the web page; the new edits were shown there.
To restart apache:
sudo apachectl -k restart
-- J
On OSX/MacOS do the following in a Terminal window:
Run php --ini at the prompt by typing it and pressing enter
Reports something like:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: (none)
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed: (none)
...this is because in /etc there is a file called /etc/php.ini.default as an example and to show it is not in use. You need to copy that file to the name php expects so that you can edit it, like this:
Type:
$ sudo cp /etc/php.ini.default /etc/php.ini (and enter your password)
...then you will see if you run php --ini again that it now sees your new file:
Typing this: php --ini at the prompt should report this:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed: (none)
...now edit /etc/php.ini - you want to make sure the following lines (NOT the same line starting with a semi-colon ';') are exactly as follows:
log_errors = On (this will turn the logging engine on)
Then, in this section:
; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; http://php.net/error-log
; Example:
;error_log = php_errors.log
; Log errors to syslog (Event Log on Windows).
;error_log = syslog
If you want to log to the syslog (or Windows Event Log on Windows) then ;error_log = syslog should become error_log = syslog
However, if as you say, you want to log to a file, you uncomment by removing the leading semi colon to make ;error_log = php_errors.log become error_log = php_errors.log or using a full path to place it where you want.
Good luck
I start with the 'Hello World!', once I get that displaying in my browser I throw a phpinfo(); in there and you can see all of the things. Tells you which configurations are loaded, everything.
<?php
echo 'Hello World!';
phpinfo();
You run php_info() and see line bellow :)
Loaded Configuration File /Applications/XAMPP/xamppfiles/etc/php.ini
Here is the complete method to modify correct php.ini in mac.
Find out the ini location via php --ini, this will give something like below:
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini
Now open the php.ini via sudo vi /usr/local/etc/php/7.4/php.ini
Make your changes and exit it via :wq
Run final command sudo apachectl restart
You are changes should be now reflected, if done correctly :)

Resources