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

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.

Related

Problems installing MySQL 5.7 properly on fresh CentOS 7 install

I admit that I am new to back-end work in general and I seem to be stuck (for several hours) following through with completing the setting up process for Magento 2.3
I was following https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html for my commands but to no success.
I managed to get the following installed:
Cent OS 7 (x86_64)
Apache 2.4.6
PHP 7.2.14 (all the extensions installed passed the Setup Wizard readiness check)
I used these commands to install MySQL 5.7 Community Release: (from the documentation)
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql mysql-server
yum -y install mysql-community-server
To check if my installation went well, when I run:
mysql --version
I received an error message saying:
-bash: /usr/bin/mysql: No such file or directory
I know that there is something I definitely am missing out completely. When I try to start the MySQL service using the command:
systemctl start mysqld
I get the resulting error message:
Failed to start mysqld.service: Unit not found.
Any suggestions will much be appreciated. Thank you in advance.
Maybe it installed it as mariadb?
systemctl start mariadb
After removing MySQL 5.7 community release from my Cent OS, I decided to install MariaDB.
Inside the directory /etc/yum.repos.d/ I've created a file called MariaDB.repo and added this into the file:
# MariaDB 10.3 CentOS repository list - created 2019-01-25 05:36 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
I then performed the command in my terminal window:
sudo yum install MariaDB-server MariaDB-client
Because of this, mysql --version and systemctl start mysql works like a charm. Thanks #greenberet123 and #danblack for the suggestion.

How can i remove instance of mysql from brew info mysql

I am trying to remove mysql from my macbook pro to start from fresh.
I have followed guides on how to remove all instances and files of mysql, however if i run
brew info mysql
I still get info pertaining to mysql 8.0 as follows:-
mysql: stable 8.0.12 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same
binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same
binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same
binaries.)
Not installed
From: https://github.com/Homebrew/homebrew-
core/blob/master/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl ✘
==> Requirements
Required: macOS >= 10.10 ✔
==> Options
--with-debug
Build with debug support
--with-embedded
Build the embedded server
--with-local-infile
Build with local infile loading support
--with-memcached
Build with InnoDB Memcached plugin
--with-test
Build with unit tests
==> Caveats
We've installed your MySQL database without a root password. To secure
it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Analytics
install: 66,127 (30d), 215,889 (90d), 794,987 (365d)
install_on_request: 61,289 (30d), 185,026 (90d), 647,998 (365d)
build_error: 444 (30d)
How can i completely remove this? Thank you for any help!
mysql is already uninstalled. See these lines in the middle of your output:
Not installed
From: https://github.com/Homebrew/homebrew-
core/blob/master/Formula/mysql.rb
Homebrew is fetching this information on mysql's dependencies and usage remotely from GitHub. I do not have mysql installed either and get the same output when I run brew info mysql. If you try running mysql from the command line, you should get -bash: mysql: command not found.

Zabbix Server crash. No connection to mysql, no log files and no system process

our Zabbix Server is running (service zabbix-server start: Job is already running: zabbix-server) and our MySQL Database is running, too.
But the dashboard of the Zabbix Server gives the following information:
"Zabbix Server is not running".
Furthermore there is no Zabbix-server process when I check the processes in the server machine with "ps aux | grep zabbix".
Moreover there a no log files.
Last day I edited the zabbix-server.conf and changed the "MaxHousekeeperDelete" from "500" to "200".
Note: This command isn´t working when in the init.d folder: "./zabbix-server -c /etc/zabbix/zabbix_server.conf"
Can someone help?
King regards :-)
Zabbix Version: 3.2
SYSTEM: Ubuntu 14.04.5 LTS (GNU/Linux 3.19.0-69-generic x86_64)
Check if there is a .pid file for zabbix on the system and delete it.
Then try to start the server again.
This should be a comment but don't have enough rep to do so.
EDIT:
Can you ensure the nscd is running with ps aux| grep nscd? If not install it with sudo apt-get install nscd
EDIT2:
Also can you please ensure that you have set START=yes in /ets/default/zabbix-server

How do I install command line MySQL client on mac?

I want to install the MySQL client for the command line, not a GUI. I have searched over the web but only found instructions on installing the MySQL server.
install MySQLWorkbench, then
export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS
This strictly installs a command line client, without the other overhead:
Install Homebrew (if you don't have it):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, install mysql-client:
brew install mysql-client
Then, add the mysql-client binary directory to your PATH:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
Finally, reload your bash profile:
source ~/.bash_profile
Then you should be able to run mysql in a terminal, if not try opening a new terminal
If you have already installed MySQL from the disk image (dmg) from http://dev.mysql.com/downloads/), open a terminal, run:
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
then, reload .bash_profile by running following command:
. ~/.bash_profile
You can now use mysql to connect to any mysql server:
mysql -h xxx.xxx.xxx.xxx -u username -p
Credit & Reference: http://www.gigoblog.com/2011/03/13/add-mysql-to-terminal-shell-in-mac-os-x/
Best option is:
brew install mysql
Mysql has a client-only set of utilities:
Mysql client shell
https://dev.mysql.com/downloads/shell/
Other command line utilities
https://dev.mysql.com/downloads/utilities/
Mac OSX version available.
There is now a mysql-client formula.
brew install mysql-client
For installing mysql-shell with homebrew, run
brew cask install mysql-shell
you can then launch the mysql shell with
mysqlsh
if you want to enter SQL mode directly, run
mysqlsh --sql
Open the "MySQL Workbench" DMG file and
# Adjust the path to the version of MySQL Workbench you downloaded
cp "/Volumes/MySQL Workbench 6.3.9.CE/MySQLWorkbench.app/Contents/MacOS/mysql" /usr/local/bin
# Make sure it's executable
chmod +x /usr/local/bin/mysql
Eject the DMG disk
Installation command from brew:
$ brew cask install mysql-shell
Look at what you can do:
$ mysqlsh --help
Run query from mysqlsh client installed:
$ mysqlsh --host=192.x.x.x --port=3306 --user=user --password=xxxxx
MySQL Shell 8.0.18
Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
WARNING: Using a password on the command line interface can be insecure.
Creating a session to 'user#192.x.x.x:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 16
Server version: 8.0.18 MySQL Community Server - GPL
No default schema selected;
type \use <schema> to set one.
MySQL 192.x.x.x:3306 ssl JS >
MySQL 192.x.x.x:3306 ssl JS > `\use rafdb`
Default schema set to `rafdb`.
If you installed from the DMG on a mac, it created a mysql client but did not put it in your user path.
Add this to your .bash_profile:
export PATH="/usr/local/mysql/bin:$PATH
This will let you run mysql from anywhere as you.
As stated by the earlier answer you can get both mysql server and client libs by running
brew install mysql.
There is also client only installation. To install only client libraries run
brew install mysql-connector-c
In order to run these commands, you need homebrew package manager in your mac. You can install it by running
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Using MacPorts you can install the client with:
sudo port install mysql57
You also need to select the installed version as your mysql
sudo port select mysql mysql57
The server is only installed if you append -server to the package name (e.g. mysql57-server)
The easiest way would be to install mysql server or workbench, copy the mysql client somewhere, update your path settings and then delete whatever you installed to get the executable in the first place.
The mysql client is available in macOS ports. If you don't have this excellent third party package manager already installed, it is available from here: https://www.macports.org/
Once you have installed macports, open a terminal and make sure everything is up to date:
sudo port selfupdate
There are multiple different versions of MySQL and mariadb (community fork of MySQL) available in the ports repos. List available versions using the following command:
port search 'mariadb*'
I recommend choosing mariadb over mysql as it is, mostly, a drop in replacement (https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/) and has excellent community support.
If applicable, choose which version of mariadb you want (a list of versions of mariadb is available here: https://downloads.mariadb.org/mariadb/+releases/). If you're not bothered, install the default version:
sudo port install mariadb
Mariadb (including the mysql-compatible command line client) is now available on your system. On my system, the CLI client resides in the following location:
$ /opt/local/bin/mysql --version
/opt/local/bin/mysql Ver 15.1 Distrib 5.5.68-MariaDB, for osx10.15 (x86_64) using readline 5.1
It's obviously a bit inconvenient to type out the full path, /opt/local/bin/mysql each time you want to use the client. Ports has already thought of this problem. To view available versions of mysql on your system, run:
$ port select mysql
Available versions for mysql:
mariadb (active)
none
Choose one from the list. For example, to use mariadb as the default mysql client:
sudo port select mysql mariadb
Now open a fresh terminal window and you should be able to start the mariadb mysql CLI client:
mysql -h <hostname> -u <username> -p
if you need a lighter solution i recommend mysql-shell, install using the command below.
brew cask install mysql-shell
To start after installation type mysqlsh.

Percona 5.6 on amazon linux ami failing

Amazon linux AMI and Percona server 5.6 don't appear to be compatible right out of the box. MySQL won't start after successful install.
In Perconas docs it does say that it is supported.
Steps to get to the below:
yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
yum install Percona-Server-server-56
Which installs the client + shared 56 libraries as well.
Some more accurate logs.
[root#* ec2-user]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root#* ec2-user]# service mysql restart
ERROR! MySQL (Percona Server) PID file could not be found!
Starting MySQL (Percona Server).......... ERROR! The server quit without updating PID file (/var/lib/mysql/ip-172-30-0-92.pid).
On the most recent Amazon Linux AMI, I was able to start the server after running these commands:
yum install 'perl(Data::Dumper)'
yum reinstall Percona-Server-server-56
If the perl-Data-Dumper package is not installed, mysql_install_db fails to run and perform the initial setup.
The Percona-Server-server-56 package should declare a dependency on perl-Data-Dumper, but you can work around that error (and avoid the reinstall) by installing it first.