How to install Percona 5.7 with TokuDB from tar file - mysql

How use Percona 5.7 with engine TokuDB using the tar file?
I want to install the binary that can be found here: https://www.percona.com/downloads/Percona-Server-5.7/LATEST/
I have done the following steps:
mkdir -p ./service
mkdir -p ./service/mysqld
mkdir -p ./service/mysqld/data
tar xfz Percona-Server-5.7.28-31-Linux.x86_64.ssl102.tar.gz --strip-components 1 -C ./service/mysqld
./service/mysqld/bin/mysqld --initialize-insecure --basedir=./service/mysqld --datadir=./service/mysqld/data --user=<my-user>
mysqld --default-storage-engine=tokudb --user <my-user>
Not sure if the above is correct and I don't know what the next step should be. I can not find any guide how to do this, only how to do it with packet manager. Any one have an idea how to continue?
Do I need to manually download the tokudb plugin or is it included? How do I start the mysql daemon?
Note I don't want to use docker or any packet manager. This I know how to do. I want to be able to install mysql under the service folder, so I can easy remove it when I'm done.

You just have to follow the official Percona documentation:
https://www.percona.com/doc/percona-server/5.7/installation.html#installing-percona-server-from-a-binary-tarball

You should not use mysqld directly to start mysql, instead use: mysqld_safe
if you go into the MySQL dir after unpacket and run:
./bin/mysqld_safe --ledir=./bin/ --basedir=. --datadir=./data
Then to load TokuDB you can run ps-admin, this requiere root access, since you want to install it in a folder I guess you don't have it. So then a better option is to connect to your mysql server using mysql client and run:
INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_file_map SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_fractal_tree_info SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_trx SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_locks SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_lock_waits SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_background_job_status SONAME 'ha_tokudb.so';
Now it should be possible to use the engine TokuDB.
However if you need more help checkout:
https://www.percona.com/doc/percona-server/LATEST/tokudb/tokudb_installation.html
I agree the instructions for this is confusing if you do not use the packet installer for the Linux distributions. Good thing with this is that its easy to remove if you fail you can just remove the folder.
If you have any problems let me know?

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.

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.

The post-install step did not complete successfully MySQL Mac OS Sierra

[(pyEnv) Anants-MacBook-Pro:litibackend anantchandra$ brew postinstall mysql
==> Postinstalling mysql
==> /usr/local/Cellar/mysql/8.0.11/bin/mysqld --initialize-insecure --user=anantchandra --basedir=/usr/local/Cellar/mysql/8.0.11 --datadir=/usr/local/var/mysql --tmpdir=/tmp
Last 15 lines from /Users/anantchandra/Library/Logs/Homebrew/mysql/post_install.01.mysqld:
2018-06-15 04:41:04 -0700
/usr/local/Cellar/mysql/8.0.11/bin/mysqld
--initialize-insecure
--user=anantchandra
--basedir=/usr/local/Cellar/mysql/8.0.11
--datadir=/usr/local/var/mysql
--tmpdir=/tmp
2018-06-15T11:41:04.901191Z 0 [System] [MY-013169] [Server] /usr/local/Cellar/mysql/8.0.11/bin/mysqld (mysqld 8.0.11) initializing of server in progress as process 37841
2018-06-15T11:41:04.903504Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2018-06-15T11:41:04.903537Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-06-15T11:41:04.903701Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.11/bin/mysqld: Shutdown complete (mysqld 8.0.11) Homebrew.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mysql`
I was able to go back to 5.7 for anyone who wants to:
brew uninstall mysql
brew install mysql#5.7
brew link --force mysql#5.7
mysql.server start
mysql_secure_installation
After all that, I'm back in 5.7 with all my databases intact. In my case, I knew the data in the databases wasn't crucial, so I didn't attempt to backup the data in advance. Worked fine for me. If you have irreplaceable data in your local databases, you might want to tread carefully. I didn't lose data, but I don't want anyone else to lose data on my advice either. ;)
Normally, I don't mind a MySQL upgrade, but 8.0 looks to have compatibility issues I'd like to vet before going forward, and in the meantime, I'd rather be back on a version that doesn't force me to deal with those issues.
The installation or re-installation, brew install mysql, created the default data directory, and the post installation does not handle it...
Simply move the existing data directory (this moves it to a sibling directory, named with the process id of the shell):
$ mv /usr/local/var/mysql /usr/local/var/mysql-$$
or might need super user privileges...
$ sudo mv /usr/local/var/mysql /usr/local/var/mysql-$$
Then run:
$ brew postinstall mysql
First, backup the content of your data directory: /usr/local/var/mysql by copying it to a safe place.
The error happens because the post-install script check if a file /usr/local/var/mysql/mysql/user.frm exists. For whatever reason you don't have this file. The postinstall script then tries to install a new MySQL 8 database by running mysqld with --initialize-insecure but as the directory already contains some data from MySQL 5.7 the script halts.
Here is the correspoding part of the script in mysql.rb:
def post_install
# Make sure the datadir exists
datadir.mkpath
unless (datadir/"mysql/user.frm").exist?
ENV["TMPDIR"] = nil
system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp"
end
end
There is several possible solutions. If you can still run your MySQL 5.7 database, export everything with mysqldump then install a fresh MySQL 8 database by removing all content in /usr/local/var/mysql and then import everything back again. Another solution, is to use the mysql_upgrade tool.
P.S.: Personally, I use the formula mysql#5.7 and I will in the future switch to MariaDB.
According to this link, below command saves me on macOS Mojave:
sudo chown -R $(whoami) /usr/local/*

mysql.sock does not exist error in fresh install of MySQL on Arch Linux

I'm trying to use MySQL on Arch Linux. it is already installed but this error comes up when I try to connect:
connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")'
I've looked for /etc/my.cfg but the file does not exist.
Something must have gone wrong during the installation.
How can I "purge" MariaDB and reinstall it?
If you're using archlinux it is a vital idea to understand the package manager (pacman). For the question about /etc/my.cfg you can run
pacman -Ql mariadb
there you will see that the file is actually called:
/etc/mysql/my.cnf
Arch linux will not configure the package for you, that is part of the arch philosophy. It will provide example configurations, and even provide you with a systemd unit file
usr/lib/systemd/system/mysqld.service
but it is your responsibility to ensure that the configuration is correct and actually start the daemon.
systemctl enable mysqld # add the unit file to the boot sequence
systemctl start mysqld # runs ExecStart= in the unit file
systemctl stop mysqld # kills the daemon
systemctl disable mysqld # remove unit from boot sequence
reinstall
Since the word reinstall is in the title of the question and someone might find this question thanks to that: To reinstall mariadb you simply do
pacman -S mariadb
pacman will reinstall a package that is already installed, there is no need to remove the package (for completeness, package removal happens with pacman -R)
as of 7-28-17 I had to do this on a new install. Newbie here might save someone some time. It was a real pain.
OK HERE IS THE DEAL!!!!!
INSTALL APACHE _ NO PROB
INSTALL MYSQL _PROBLEM
pacman -S mysql then before starting service
MUST UNCOMMENT INNODB IN:
nano /etc/mysql/my.cnf
then must initialize datadirectory before starting service:
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
You need to initialize the MariaDB data directory prior to starting
the service. This can be done with mysql_install_db command, e.g.:
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Optional dependencies for mariadb
galera: for MariaDB cluster with Galera WSREP
perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and
mysql_setpermission
CNF file is /etc/mysql/my.cnf in Arch Linux.
One simple way I can reproduce your issue is when MariaDB is shut down. Sorry if it sounds dumb but as you did not mention it: is MariaDB started? sudo systemctl start mysqld.service
You should have a look at MariaDB logs to get some clue: journalctl _SYSTEMD_UNIT=mysqld.service (maybe paste some part if you still don't get what is going on).
This happens the first time you install MySQL and MariaDB. As grochmal pointed out, you have to set up configurations before first use. But, the user teckk sent these three links in the archlinux newbie corner:
https://wiki.archlinux.org/index.php/MariaDB
https://wiki.archlinux.org/index.php/MariaDB#Reset_the_root_password
https://bbs.archlinux.org/viewtopic.php?id=51981
In short, you have to run the command below before starting the service:
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Optionally (recommended) you should improve the initial security by calling:
sudo mysql_secure_installation
Now you can start the service:
sudo systemctl start mariadb
Optionally, you could install and use a graphical front-end tool.
Carry on with setting up the configurations as described in the archwiki post on MariaDB Configuration.

can't run mysql under my user account

I installed mysql using Homebrew on my mac. It's the latest version of mysql (5.7.9). I followed the instructions from this link. Everything went fine until I had to run the command
mysql_install_db --verbose --user='whoami' --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
It spit out the errors
mysql_install_db: [ERROR] unknown variable 'tmpdir=/tmp'
2016-01-18 16:52:42 [ERROR] Unrecognized options
The mysql_install_db command has been deprecated as of version 5.7.6, so the guide you linked is no longer valid:
mysql_install_db is deprecated as of MySQL 5.7.6 because its functionality has been integrated into mysqld, the MySQL server. To initialize a MySQL installation, invoke mysqld with the --initialize or --initialize-insecure option. For more information, see Section 2.10.1.1, “Initializing the Data Directory Manually Using mysqld”. mysql_install_db will be removed in a future MySQL release.