Can't start mysql (Homebrew Mac M1) - mysql

I have a error when i try to run the MYSQL server
When i try to run with brew services start mysql, return me this error
brew services start mysgl
Bootstrao failed: 5: Inout/outout error
Try re-running the command as root for richer errors
Error: Failure while executina;
`/bin/launchetl bootstrap qui/501 /Users/<user>
/Library/LaunchAgents/homebrew.mxcl.mysql.plist`exited with 5
If i ran this with sudo don't work
%
sudo brew services start mysgl
Warning: Taking root:admin ownership of some mysql paths:
/opt/homebrew/Cellar/mysql/8.0.30_1/bin
/opt/homebrew/Cellar/mysq1/8.0.30_1/bin/mysqld_safe
/opt/homebrew/opt/mysql
/opt/homebrew/opt/mysql/bin
/opt/homebrew/var/homebrew/linked/mvsal
This will require manual removal of these paths using
sudo rm' on
brew upgrade/reinstall/uninstall.
Warning: mysql must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.mysql.plist:servic ealready bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing: `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.mysql.plist`exited with 37
<user>~ % brew services list
Name status User File
mysql stopped root ~/Librarv/LaunchAgents/homebrew.mxcl.mvsal.olist
I was try to unistall and install the HomeBrew and the MYSQL again but always had the same ¡s errors.
Thanks for the help.

Not a real answer:
If it is not absolutely required for you to run it as a native process, run it in docker.
Besides that: mysql wants to run as root, as the error message says. Maybe you need to correct the mode bits. Inspect the brew post installation steps carefully, usually there is a hing or command to execute.

Related

Install MySQL v8 in Google Colab. Service is not starting. Not recognised

I have been successfully installing and using MySQL V5.7 in Google Colab (with Ubuntu 18.04) for quite some time. However trying to install MySQL V8 has repeated failed. I have used the following sequence of commands ..
!apt update
!apt upgrade
#!wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.11-1_all.deb
!wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
!dpkg -i mysql-apt-config_0.8.*
!sudo apt update
!sudo apt install mysql-server
During the install, I provide the root password and have used both the strong password option as well as the legacy authentication. Everything goes fine upto this point and even the following command
!mysqld --version
returns the correct version
/usr/sbin/mysqld Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)
After this things go wrong! The MySQL service should have started but it hasn't
!mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
and when I try to start it, it is not recognised ( neither mysql nor mysqld)
!sudo service mysqld start
mysqld: unrecognized service
in fact, even this fails
!systemctl status mysql
System has not been booted with systemd as init system (PID 1). Can't operate.
What am I doing wrong? or what else should I do? or is it that for some reason, Google Colab with Ubuntu 18.04 does not support MySQL V8
No action required ... just this will do
!apt update > null
!apt -y install mysql-server -V
!/etc/init.d/mysql restart
then check
!mysql --version
mysql Ver 8.0.31-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
earlier this used to show Ver 5.7!
Now, with this we can now use CTE, recursion and Windows functions of v8
Check with sudo service mysql start or sudo start mysql once.
Another thing is that google colab instance might not use the system init system at all. That's why it's resulting in System has not been booted with systemd as init system. Check with the sys-v init system once. Its commands look like service service_name start. The same thing happens when trying to start services in WSL.

MySQL brew cannot run on macOS Monterey?

MySQL suddenly stopped working after updating from macOS Big Sur to Monterey (naive). Local Laravel dev environment suddenly lost connection to MySQL. Couldn't debug it properly (still learning), so decided to do a fresh MySQL installation via brew. Was installed through brew previously as well.
On the final step, mysql_secure_installation shows this:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
brew services start mysql
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/stranger/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.
Am I doing something wrong? Why would it suddenly drop?
Thanks!
Not a solution, but, according to the MySQL documentation, Monterey is not yet a supported platform.
MySQL Supported Platforms
I tried brew uninstall mysql, brew install mysql and then brew services restart mysql and it did the trick for me

Error while running mysql_secure_installation on arch linux

I'm trying to install MySQL(pure) on Arch Linux so I downloaded the following file from https://dev.mysql.com/downloads/mysql/.
mysql-8.0.26-linux-glibc2.17-x86_64-minimal-rebuild.tar.xz
I extracted it and tried to run ./mysql_secure_installation but after I enter the root password I get the following error message:
[rob#archrob bin]$ sudo ./mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
How can I fix this?
I tried to download it from AUR repository too but when I run the makepkg -si it get a point of the installation it looks like will take forever.
Build files have benn written to /home/rob/mysql/src/build
[0%] Built target INFO_BIN
[0%] built target abi_check
[0%] built target INFO_SRC
[0%] Building CXX object extra/protobuf...
[0%] and so on...
After one hour it was at [22%] so I stopped the installation and tried from the official website.
You'll need to start mariadb before running mysql_secure_installation:
$ sudo systemctl start mariadb.service

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..

Cannot find MySQL -- get "command not found" error when trying to access MySQL from command line

I have previously installed, connected and uploaded to a WordPress MySQL database via SSH no problem. The people who run my server made a few configuration changes, and now I get a "bash: mysql: command not found" error when I try to log into MySQL via the command line on the same server to access the same database.
I am relatively new to all of this, so I am really not sure what to do. When I run "which mysql" I get a message that says there is no MySQL executable in the /usr/bin directories. I can verify that MySQL is running between the fact that my site is still live and functioning and when I ran a command to test MySQL, I got a message that said "MySQL works!"
I find MySQL files in several directories, but I'm not really sure what I am looking for and how I connect to it when I do find it. I am also not sure if this is user error, or if somehow someone moved or hid MySQL from me -- likely user error??
A MySQL server is not a MySQL client.
Check if MySQL is running by executing this command:
ps aux | grep mysql | grep -v grep
And install the MySQL client:
sudo apt-get install mysql-client # Or your distribution command
If you have MySQL server up and running on your server, it does not mean you have a MySQL client installed on this server.
Try
ls -l /usr/bin/mysql*
Do you see MySQL binaries exactly present on system?
One more problem: Linux has very strange behaviour when you run binaries for another architecture.
For example, if you run a 32-bit executable on 64-bit system you will get an error message like "command or file not found", even if the binaries are actually present!
Now mysql-client has changed to default-mysql-client.
Hence the command:
sudo apt-get install default-mysql-client
Although MySQL is running, if you are not able to connect to the server using the mysql command, then you might be missing to provide soft links:
sudo ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
sudo ln -s /usr/local/mysql/bin/mysql /usr/bin
This should enable you to connect.
In order to get MySQL CLI working or to access the mysql command from anywhere, there are a set of steps to be done to add it to the $PATH variable.
First, open a terminal, and run the following command
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
Then to reload the Bash profile, run
. ~/.bash_profile
Now run,
mysql -u root -p
Enter the password which you gave during installation. You should see the following result:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23 MySQL Community Server - GPL
You sometimes need to install MySQL on the local machine as well. That means, if you have a host running a MySQL Docker container, the strange thing happened to me that I needed to install mysql-server on the host as well, not only in the container.
The reason was that there was a shell script that needed to check the right database name from a query. In your case, it might be something different. On your host machine (which might even be your local computer, depending the your setup), if on Linux, try:
sudo apt-get update && sudo apt-get install mysql-server
Then you will get rid of
/home/.../some_bash_script.sh: line 123: mysql: command not found