Big Sur mySQL - php - apache simple low maintenance configuration needed

Created at: 2021-05-30 04:08:38
Questioner General

Short version of my questions: what is the way forward for hobbiest-learners who want to use the triad of apache-php-mySQL to do a bit of web development?



After not touching my setup for a couple years and many OS upgrades I have set about getting the pieces back up and running together. The php and apache took a bit of fiddling but they are working fine though the warning that php will not be a part of future OS is a little concerning. Getting mySQL running has taken the better part of two days without succeeding. There are dozens of results returned by searches but so far none have worked. There are problems with paths, the shell, and permissions. mySQL Workbench has not helped. Some of the errors are listed below.



I am looking for two things here... a listing of what it takes to get mySQL working on my local computer (Big Sur) and some insight about whether this is a lost cause to reasonably maintain. And by reasonable I exclude keeping up with weekly upgrades or significant reconfigurations with each new OS.

mysql -u root -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)



sudo: /usr/local/mysql/bin/mysql.server: command not found



mysqld_safe --skip-grant-tables &

[1] 41040

pamelaparks@Blackie ~ % /usr/local/mysql/bin/mysqld_safe: line 653: /usr/local/mysql/data/Blackie.local.err: Permission denied

Logging to '/usr/local/mysql/data/Blackie.local.err'.

2021-06-25T20:15:09.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/Blackie.local.err: Permission denied

/usr/local/mysql/bin/mysqld_safe: line 199: /usr/local/mysql/data/Blackie.local.err: Permission denied

/usr/local/mysql/bin/mysqld_safe: line 916: /usr/local/mysql/data/Blackie.local.err: Permission denied

2021-06-25T20:15:09.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/{pamelaparks}.pid ended

/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/Blackie.local.err: Permission denied



Answer #1:

By: Melissa Mitchell

Short version of my questions: what is the way forward for hobbiest-learners who want to use the triad of apache-php-mySQL to do a bit of web development?



After not touching my setup for a couple years and many OS upgrades I have set about getting the pieces back up and running together. The php and apache took a bit of fiddling but they are working fine though the warning that php will not be a part of future OS is a little concerning. Getting mySQL running has taken the better part of two days without succeeding. There are dozens of results returned by searches but so far none have worked. There are problems with paths, the shell, and permissions. mySQL Workbench has not helped. Some of the errors are listed below.



I am looking for two things here... a listing of what it takes to get mySQL working on my local computer (Big Sur) and some insight about whether this is a lost cause to reasonably maintain. And by reasonable I exclude keeping up with weekly upgrades or significant reconfigurations with each new OS.

mysql -u root -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)



sudo: /usr/local/mysql/bin/mysql.server: command not found



mysqld_safe --skip-grant-tables &

[1] 41040

pamelaparks@Blackie ~ % /usr/local/mysql/bin/mysqld_safe: line 653: /usr/local/mysql/data/Blackie.local.err: Permission denied

Logging to '/usr/local/mysql/data/Blackie.local.err'.

2021-06-25T20:15:09.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/Blackie.local.err: Permission denied

/usr/local/mysql/bin/mysqld_safe: line 199: /usr/local/mysql/data/Blackie.local.err: Permission denied

/usr/local/mysql/bin/mysqld_safe: line 916: /usr/local/mysql/data/Blackie.local.err: Permission denied

2021-06-25T20:15:09.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/{pamelaparks}.pid ended

/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/Blackie.local.err: Permission denied



Answer #2:

By: Raquel Rohan

I tried it again and it worked perfectly. I only tested it in Big Sur. I installed in a VM with no other 3rd party software installed.



You can't uninstall apps, especially anything like this, by deleting files. You'll never find them all. Don't use any "clean up" or "app zappers" either. They will also not find all the files, and also delete system files that were not actually part of the installation.



The current 8.0 version of MySQL for the Mac includes and "Uninstall" button in the Preference Pane. That is the only way to uninstall it.



The most likely explanation is that your computer is jacked up in some other way. I suggest you backup the computer with Time Machine, erase the hard drive, and reinstall the operating system. If you want to restore from backup, you can restore only your user documents and user accounts. Do NOT restore any software or "other files". Manually reinstall those one by one.

Answer #3:

By: Lillie Towne

I didn't that that on an M1. There is a decent chance that something like this, from Oracle, won't work on Apple Silicon.



The most likely cause of this problem is some previous attempt at installing MySQL (***cough***, ***cough***, homebrew, ***cough***) which left the configuration files in a bad state. Subsequent installations would probably honour your existing config files, whether they worked or not. Said config files may be in multiple locations. All of those locations will be hidden and hard to find.

Answer #4:

By: Jakayla Sauer

pamela.parks wrote:


Short version of my questions: what is the way forward for hobbiest-learners who want to use the triad of apache-php-mySQL to do a bit of web development?

Have you seen this User Tip? Setting up a local web server on macOS 11 “Big Sur”

After not touching my setup for a couple years and many OS upgrades I have set about getting the pieces back up and running together. The php and apache took a bit of fiddling but they are working fine though the warning that php will not be a part of future OS is a little concerning.

There is more to that that I can't mention here...

Getting mySQL running has taken the better part of two days without succeeding.

In the User Tip above, there is a link to a really old User Tip for installing MySQL. I will update it after I finish this reply. But it looks like the current installer is almost fully functional. The only parts you need to add are:



alias mysql=/usr/local/mysql/bin/mysql

alias mysqladmin=/usr/local/mysql/bin/mysqladmin



To your environment. Oracle seems to think Apple is still using bash, but this is close enough for Oracle I guess.

Answer #5:

By: Dr. Fausto Johns

Have you seen this User Tip? Setting up a local web server on macOS 11 “Big Sur”



Indeed I used your User Tip to get as far as I got. Bad manners to have not mentioned this. The instructions had perfect results right up to the point of installing mySQL. And I had used your second tip on installing mySQL though I had not included those two alias. So now that is done and my .zshrc looks like this:



export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

alias mysql=/usr/local/mysql/bin/mysql

alias mysqladmin=/usr/local/mysql/bin/mysqladmin

export PATH="/usr/local/mysql/bin:$PATH"

PROMPT='%F{green}%n@%m %. %% %f'



I threw in the prompt coloring so I would know something happened. Quit the terminal. Took a look at the system preferences mySQL panel and got the exact same behavior as before which is the server shows red status and blinks to green and then back....repeats endlessly. So then I open terminal and see the modified prompt and enter a couple commands to start or restart mysql:



pamelaparks@Blackie ~ % mysql.server start

zsh: command not found: mysql.server



pamelaparks@Blackie ~ % sudo /usr/local/mysql/support-files/mysql.server restart

Password:

ERROR! MySQL server PID file could not be found!

Starting MySQL

.Logging to '/usr/local/mysql/data/Blackie.local.err'.

. ERROR! The server quit without updating PID file (/usr/local/var/mysql/{pamelaparks}.pid).



This pretty much is the same sort of failures I was getting before.

Answer #6:

By: Rigoberto Bogisich

I suggest you delete /usr/local/mysql and reinstall using the latest version 8 installer. You will have to add those two aliases, or set your path - you don’t need both. Otherwise, there is nothing to do. The installer sets everything up correctly and starts the server.

Answer #7:

By: Mrs. Connie Effertz

1st Try:

Deleted /usr/local/mysql

Removed the extra path in zshrc

Exactly the same behavior



2nd Try:

Deleted /usr/local/mysql again

Deleted every folder on my machine named mysql

Rebooted

Fresh download and install of latest mysql DMG

Exactly the same failure

flashing between started and stopped on the sys pref panel



There is something else amiss. Perhaps there is something about that download that does not work with Big Sur?



zshrc looks like this now:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

alias mysql=/usr/local/mysql/bin/mysql

alias mysqladmin=/usr/local/mysql/bin/mysqladmin

PROMPT='%F{green}%n@%m %. %% %f'

Answer #8:

By: Ladarius Lemke

I tried it again and it worked perfectly. I only tested it in Big Sur. I installed in a VM with no other 3rd party software installed.



You can't uninstall apps, especially anything like this, by deleting files. You'll never find them all. Don't use any "clean up" or "app zappers" either. They will also not find all the files, and also delete system files that were not actually part of the installation.



The current 8.0 version of MySQL for the Mac includes and "Uninstall" button in the Preference Pane. That is the only way to uninstall it.



The most likely explanation is that your computer is jacked up in some other way. I suggest you backup the computer with Time Machine, erase the hard drive, and reinstall the operating system. If you want to restore from backup, you can restore only your user documents and user accounts. Do NOT restore any software or "other files". Manually reinstall those one by one.

Answer #9:

By: Frederic Greenfelder

Thanks for sticking with me on this. Uninstall mysql was no help. Agree the next or at least the shortest way to get it working is to start with a clean slate. Fortunately I don't need to nuke everything to achieve that. I have an underutilized M1 mini that can be set back to factory for this purpose.



If I get a chance once that is up and running I can go through some of the relevant os dirctories with a file comparison tool to see if I can find the needle in the haystack. If I can find it I will post it. I have noticed that the problem I am having is not unique.

Answer #10:

By: Griffin Daniel IV

I didn't that that on an M1. There is a decent chance that something like this, from Oracle, won't work on Apple Silicon.



The most likely cause of this problem is some previous attempt at installing MySQL (***cough***, ***cough***, homebrew, ***cough***) which left the configuration files in a bad state. Subsequent installations would probably honour your existing config files, whether they worked or not. Said config files may be in multiple locations. All of those locations will be hidden and hard to find.

Answer #11:

By: Miss Haven Parker

I had the whole setup working on the M1 mini in less than 15 minutes. Then I wasted a couple hours trying to find the difference between the laptop and the mini.

Answer #12:

By: Ms. Reina Jones IV

You should cough more often! After the install went so smoothly on the M1 and the file comparison between working and non working setups failed I looked back at your note because your mention of "homebrew" rung a bell. Did you know that homebrew has an uninstall? Ran it. Retried the mySQL and it was working! The rat in the pile was homebrew.



So a quick test of a new a page that connected to a nice new db and the almighty root can do it. Now if I can just get the thing to work with a normal user... another day. Today I am so pleased with the progress. Thank you!

Answer #13:

By: Estefania Powlowski

pamela.parks wrote:


You should cough more often! ... The rat in the pile was homebrew.

Coughs aren't good these days. They were always euphemisms for "other words" anyway. 😄

So a quick test of a new a page that connected to a nice new db and the almighty root can do it. Now if I can just get the thing to work with a normal user... another day. Today I am so pleased with the progress. Thank you!

You have to do that inside MySQL itself. Permissions are tied to individual databases and tables, and based on user names and user locations. I checked the official MySQL documentation and it didn't say much about this. This tutorial from Digital Ocean is adequate: https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql



I'm not necessarily recommending Digital Ocean. In fact, I found their MySQL services to be quite poor.