Composer Self-Update Error Exception "Permission Denied" when calling rename() - mysql

So, whenever i run composer self-update or composer selfupdate I get the following error:
[ErrorException]
rename(/Users/jrobinson/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied
I'm not too sure what's going on. I THINK i may had screwed up my .bash_profile file up. I wasn't having this issue prior to installing MySQL on my machine, and updating the first line in my .bash_profile.
I have looked at other articles, and I have tried reinstalling using the getcomposer.org commands on their download page. None of these solutions have fixed my problem. So please don't mark this as a repeat question as none of the solutions on SO have helped me solve this issue.
Here is my .bash_profile file contents.
export PATH="~/.composer/vendor/bin:$PATH:/usr/local/mysql/bin"
export EDITOR='sub -w'
Here is the ls -la command run in the /usr/local/bin folder.
Goal
Be able to run the composer self-update command and the mysql command from my terminal at the end of all this.

It looks like Composer is installed in /usr/local/bin, so you probably did that as root. To update it, you also need to be a root - try with sudo:
sudo -H composer self-update

Related

ERROR! The server quit without updating PID file on El captian

I have problem mysql starting, i was update to El captian on mac.
In terminal,
brew install mysql
mysql.server start
but it not working
this is error message.
Starting MySQL... ERROR! The server quit without updating PID file(/usr/local/var/mysql/Heo-MacBook-Pro.local.pid).
help me please!
I had the same problem using brew command to start mysql service.
If you are using MacOS, go to System Preferences and click on MySQL icon. Probably you'll see information message about permission denied in some directories. All you need to do is to give permission to that.
That's worked for me.
Open your terminal
Execute this command: sudo chown -R mysql /usr/local/mysql/data
Try this first:
/usr/local/var/mysql/support-files/mysql.server restart
If that doesn’t fix
Remove or backup the /etc/my.cnf
also try this method:
sudo /usr/local/var/mysql/support-files/mysql.server start
Starting MySQL
. ERROR! ....................
remove the .err files like so:
rm *.err /usr/local/var/mysql/data/
Solution working for my case:
Check your error log at /usr/local/var/mysql/Heo-MacBook-Pro.local.err
If there is something like this in the log: ...[Note] Unable to delete pid file: Permission denied..., which means mysql does not have the permission to your mysql folder
Use the following command in terminal to grant the permission: sudo chown -R mysql /usr/local/var/mysql/
The Problem could also be a version mismatch. My db was installed with Homebrew as version 5, later unintentionally upgraded to version 8.
Check the most recent error log at /usr/local/var/mysql/<your-computers-name.some.domain>.err
You can conveniently read the last couple of lines (e.g. 40) of the file with tail -n 40 <your-computers-name.some.domain>.err
You may find a hint about upgrading istructions in this case.

Systemwide permission problems

I've been installing Node, NVM, NPM and some other tools lately on my MacBook. After a while, suddenly, I discovered that mysqld wasn't booting anymore due to the following:
Operating system error number 13 in a file operation. The error means mysqld does not have the access rights to the directory.
I figured I should reinstall mysql with brew, but doing that led to:
$ brew remove mysql
Uninstalling /usr/local/Cellar/mysql/5.6.17_1...
Error: Permission denied - /usr/local/include/mysql
Than tried:
$ brew cleanup
Removing: /usr/local/Cellar/openssl/1.0.1g...
Error: Permission denied - /usr/local/Cellar/openssl/1.0.1g/bin/c_rehash
Also installing fails:
$ brew install mysql
Error: Cannot write to /usr/local/Cellar
I didn't change anything to brew or it's directories, so this problem is coming from somewhere else. I remember when installing NVM I made some changes to permissions, but can't remember exactly what is was..
Turns out in the past I changed the owner of /usr/local. Changing it back to whoami did the trick..

Error running mysql_install_db: could not find ./bin/my_print_defaults

I seem to be having an issue getting MySQL 5.6.1.5 to install from Source. I am running RHEL 6.
I was able to perform the cmake, make, and make install without issues.
I am attempting to run the mysql_install_db binary and when I do I get the following error:
Fatal ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to copy the software
into the correct location ready for operation.
If you are using a binary release, you must either bat at the top level of the
extracted archive, or pass the --basedir option pointing to that location.
So I did a check for my_print_defaults using which my_print_defaults, unfortunately it was not found on my machine.
I did a locate my_print_defaults as well just for the heck of it and said it was located in /usr/bin/my_print_defaults, however, when I checked /usr/bin for the binary, it was not actually there.
I would try to use mysql_install_db --basedir=/usr/bin but I know this won't work as the which and locate commands confirm my_print_defaults isn't on my machine.
I looked at mysql_install_db giving error, but that error was not similar to this one.
Please ignore question, I didn't bother to try running find / -name my_print_defaults and found it in /usr/local/mysql/bin/
I searched packages for my_print_defaults with
apt-file search my_print_defaults
If my_print_defaults is missing on your system (which my_print_defaults), first find out which db is installed with:
dpkg -l |grep -E 'maria|mysql'|grep ii|grep server
If you have installed mariadb, try reinstall mariadb:
sudo apt install --reinstall mariadb-server-core-10.1
If you don't find a solution with mariadb, swap back to mysql with
sudo apt install mysql-server

Mysql_install_db cannot find file

I am trying to use mysql_install_db
I am getting the following error:
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
I've tried using
which my_print_defaults
It returns:
/usr/local/bin/my_print_defaults
So I try the command:
mysql_install_db --base-dir=/usr/local/bin/
I still receive the same error, though.
Annoyingly, this just means you have to be in the right directory to execute this. Make sure you're in /usr/local/Cellar/mysql/<version>/ before running the script.
You must run the command:
# mysql_install_db --basedir=/usr/local
That is without bin. This option must specify a directory path location of the directory ./bin.
Anyone reading this after installing MySQL with Homebrew may have experienced this issue:
https://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m
And then found their way here after the final instruction didn't work. I simply ran
mysql.server start
after reading http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial
Then it all started working miraculously (seems I just hadn't started it?!).
If you use Brew, try to run mysql_install_db with --basedir="$(brew --prefix mariadb)"
Change mariadb to mysql if you use mysql.
For me the fix was to point basedir to the actual mysql directory in the cellar, as shown at install.
eg:
During installation of mysql (using brew install mysql56), I was shown this path: /usr/local/Cellar/mysql56/5.6.27/bin/mysql_install_db...
I used that to define the basedir like so:
mysql_install_db --verbose --user=`whoami` --basedir="/usr/local/Cellar/mysql56/5.6.27" --datadir=/usr/local/var/mysql --tmpdir=/tmp
gotta add the path of mysql installation in system path
try: sudo path=${PATH}:/usr/local/mysql/bin
if you installed mysql in "/usr/local/mysql"

brew link mysql did not complete

For some some reason brew does not link mysql and it complains about permission.
I chmod the folder to 777 but I am still having the same issues
laptop$ brew install mysql
Error:
mysql-5.5.27 already installed, it's just not linked
laptop$ brew link mysql
Linking /usr/local/Cellar/mysql/5.5.27... Warning: Could not link mysql.
Unlinking...
Error:
Could not symlink file: /usr/local/Cellar/mysql/5.5.27/lib/plugin
/usr/local/lib is not writable. You should change its permissions.
I figured what the problem was.
It was issues with premission and I basically did this
sudo chown -R $(whoami) /usr/local/lib/
I believe You should:
sudo chmod 775 /usr/local/lib/
and make sure You are member of the file's group.
Not really an answer, but a comment that may help those who are pulling out hair chowning and chmoding like crazy and still getting "not writeable" errors at linking. For example, from $ brew doctor -d
Error: /usr/local/lib/pkgconfig isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
I suggest you check the linked file and it's dependencies and either delete them and reinstall via homebrew, or install the package without using homebrew.
In my system this worked perfectly.
chown -R $(whoami) /usr/local/share/
I am trying to give a general answer to the question.
It happens that neither /usr/local/lib/ nor /usr/local/share/ gives error. You should look the exact directory that is not writable. It is mentioned right after "Error: Could not symlink". So execute the command for that directory.
chown -R $(whoami) [/bath/to/your/dir]