Installing Connector C for Mariadb - mysql

So, I want to use Mariadb. There is this Connector-C for it.
https://downloads.mariadb.org/connector-c/
How do I install it? Quiet frankly, the documentation for it is horrible. Even the src file for 3.0.5 is linked to 3.0.4 page.
I did not find a way to install the binary, and the documentation for building from src is quiet vague. I would prefer to know how to install both ways (binary and build from source)
I'm using CentOS7 64bit.

The easiest way to install it would be to use the MariaDB package repository.
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum -y install MariaDB-devel
As for building from source, these steps should work on CentOS 7.
sudo yum -y install git gcc openssl-devel make cmake
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

And for Ubuntu 20.04...
sudo apt-get install libmariadb3 libmariadb-dev

Raspberry Pi OS
cd to preferred build location. Then install (thanks to #markusjm!):
sudo apt install git gcc make cmake libssl-dev
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
Then add installation directory to LD_LIBRARY_PATH. Note: my installation directory is /usr/lib/mariadb. If you cannot find this after your installation, search for e.g. libmariadb.so, a file that should reside in your installation folder.
export LD_LIBRARY_PATH=/usr/lib/mariadb:$LD_LIBRARY_PATH
Afterwards you can finally pip3 install mariadb, if, like me, you tried to do that in the first place.

After you download MariaDB Connector/C, untar and cd. Then mv the executable first.
sudo mv -f bin/mariadb_config /usr/bin/
Now you can execute mariadb_config and will know where to put header and library files to build wheel for mariadb.
For example,
Ubuntu 18.04
sudo mv -f include/mariadb /usr/local/include/
sudo mv -f lib/mariadb /usr/local/lib/
CentOS 7 & Ubuntu 20.04
sudo mv -f include/mariadb /usr/include/
sudo mv -f lib/mariadb /usr/lib/
Finally, you could pip install mariadb. (Or, export CFLAGS=-std=c99 may help.)
After, in the case you cannot import mariadb,
export LD_LIBRARY_PATH=/PATH/TO/where/you/mv/lib/mariadb

Related

High version qemu-mipsel could not find libs automatically

System info
kernel:Linux ubuntu 5.4.0-121-generic #137~18.04.1-Ubuntu SMP Mon Jun 20 07:25:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
Default version of qemu installed by apt will cause system error when using gdb-multiarch to debug mips executable files. So i'm trying to compile the source codes.
I've installed re2c, ninja and some packages, which are the dependency of qemu.
wget https://github.com/skvadrik/re2c/releases/download/3.0/re2c-3.0.tar.xz
tar -xvzf re2c-1.0.1.tar.gz
cd re2c-1.0.1/
./configure
make -j4
sudo make install
cd ..
git clone https://github.com/ninja-build/ninja.git
cd ninja
./configure.py --bootstrap
sudo cp ninja /usr/bin/
ninja --version
cd ..
sudo apt install build-essential zlib1g-dev pkg-config
sudo apt install libglib2.0-dev binutils-dev libboost-all-dev libssl-dev
sudo apt install libpixman-1-dev libfdt-dev libsdl2-dev
Then i'd like to build qemu statically and get executable like qemu-mipsel(which are static linked so i rename the files with -static suffix). But when i was trying to run any mips executable file, i got error below.
$ ./qemu-mipsel-static (mips_file_name)
qemu-mipsel-static: Could not open '/lib/ld.so.1': No such file or directory
I'm sure that the arch and endian is right. And i copied related lib files in /usr/mipsel-linux-gnu/lib to current directory and using option -L to specify the lib file path. I got the same result.
And i tried the version installed by apt, It can run smoothly.
Commands for installing qemu via apt are as followed.
sudo apt-get install qemu
sudo apt-get install qemu-user-static
sudo apt-get install qemu-system
sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
However, as for the higher version of qemu compiled by source code, when i was tring commands below, it can run smoothly.
chroot . ./qemu-mipsel-static (mips file)
I wonder the reason and how to correctly run the file using ./ and chroot two ways. Thanks for your help!

How to install mysql workbench in debian buster?

I tried the following commands :
sudo dpkg -i mysql-apt-config_0.3.5-1debian8_all.deb
sudo apt-get update
sudo apt-get install mysql-workbench-community
but on searching mysql-workbench-community
sudo apt-cache search workbench | grep mysql
returns nothing.
And
sudo apt-get install mysql-workbench-community
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysql-workbench-community
What to do ?
I did manage to install without issues MySQL Workbench 8.0.19 version from an Ubuntu package in Debian Buster, with the command:
sudo dpkg -i mysql-workbench-community_8.0.19-1ubuntu18.04_amd64.deb
First you must download the package from the mysql website:
Just select Ubuntu Linux operating system and 18.04 version (19.10 version had broken dependencies) .
Hope this helps.
MySQL Workbench mysql-workbench has been removed from Debian buster due to a release-critical bug.
https://tracker.debian.org/pkg/mysql-workbench
https://tracker.debian.org/news/943250/mysql-workbench-removed-from-testing/
https://bugs.debian.org/867943
https://bugs.mysql.com/bug.php?id=89898
It can also be installed from Snapcraft. I haven't used it that much, but apparently it works. First you need to enable snapd:
$ sudo apt update
$ sudo apt install snapd
$ sudo snap install core
Then install MySQL workbench (community edition):
$ sudo snap install mysql-workbench-community
If you want to delete it, simply:
$ sudo snap remove mysql-workbench-community
I was able to install the latest version of MySQL Workbench (as of this writing) on Debian 10 using this method:
sudo apt install ./mysql-workbench-community_8.0.23-1ubuntu20.10_amd64.deb
A couple dependencies were missing so I subsequently ran:
sudo apt --fix-broken install
Just started using it, but MySQL Workbench seems to be running fine. It's also worth mentioning the link below states MySQL Workbench community is not available on Debian, although I'm not sure why this is the case.
mysql-workbench-community - MySQL Workbench (not available for Debian
platforms)
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-available
Command line to install mysql on Debian 10:
$ sudo apt update
$ sudo apt upgrade
$ wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
Remember to make safe passwords with lettler numbers and symbols
$ sudo apt update
$ sudo apt install mysql-server
$ sudo apt-get build-dep mysql-server
$ wget https://downloads.mysql.com/archives/get/file/mysql-workbench-community_8.0.16-1ubuntu18.04_amd64.deb
$ sudo dpkg -i mysql-workbench-community_8.0.16-1ubuntu18.04_amd64.deb
$ sudo apt install -f
$ sudo dpkg -i mysql-workbench-community_8.0.16-1ubuntu18.04_amd64.deb
have a nice coding!

Can't install older version 1.8.27 of Geth on Ubuntu 16.04

I have tried
sudo apt-get install ethereum
sudo apt-get install ethereum=VERSION
And
sudo apt-get upgrade ethereum
To install a specific version of Geth but I can't.
An older version of Geth can be installed using tar file, here I am using version 1.8.16. To download the required Geth file, we need to check the OS version using the following command.
> dpkg --print-architecture
amd64
Once you have your OS information, download (amd64 tar in our case) file from the Geth website.
Upload downloaded tar file on a server and extract using the following command:
sudo tar -xvf <filename>
In our case,
sudo tar -xvf geth-linux-amd64-1.8.16-477eb093.tar.gz
Step into extracted folder
cd geth-linux-amd64-1.8.16-477eb093
It should contain the geth file, make it executable with the below command.
sudo chmod +x geth
Copy file to the user bin.
sudo cp geth /usr/local/bin/
Check the Geth version with the following command
> geth version
Version: 1.8.16-stable
Geth is now installed successfully on the system
Ref: How To Install Geth On A Linux Machine
You can get the older versions from here:
https://github.com/ethereum/go-ethereum/releases
To install ethereum on Ubuntu type the following commands into your CLI:
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt update
Once this is done type:
sudo apt install ethereum

Cannot install Chrome on Ubuntu 16.04

Doenloaded the .deb package of Chrome from Google's site. The installation doesn't work when trying to install from the GUI. What's up with that?
Its very simple to install google chrome on ubuntu . Type the following commands in the terminal
Step 1 : Download the latest Google Chrome .deb package with wget:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Step 2 : Install the Google Chrome .deb package
sudo apt install ./google-chrome-stable_current_amd64.deb
Hope this helps!
Google Chrome requires some missing dependencies as can be seen when trying to install from the terminal using dpkg -i. Prior to installing Chrome, run:
sudo apt-get install libindicator7 libappindicator1
After that, Chrome installation works fine.
Update the packages first in Ubuntu by below command.
$ sudo apt-get update
Install Required Dependices for Google Chrome as shown below.
$ sudo apt-get install libnss3-1d libxss1 libgconf2-4 libappindicator1 libindicator7
Download the Google Chrome command using below command.
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
still during installation if you get some error that some dependency is not installed run the below command and it will install all required dependencies.
$ sudo apt-get -f install
Now let's go ahead and install Google Chrome by below command.
$ sudo dpkg -i google-chrome-stable_current_amd64.deb
And its done....
To open it just run below command command
$ google-chrome
You can download the latest package of chrome here
Install the package by clicking on it, or via the terminal:
sudo dpkg -i google-chrome-stable_current_amd64.deb
If you have issues, you may have to run:
sudo apt-get -f install
sudo dpkg -i google-chrome-stable_current_amd64.deb
Alternatively you can use gdebi to install the .deb packages.
It's a lightweight application that is better at installing .deb packages, and is quicker as well. If there are dependencies, it notifies that as well.
To install it type this in the terminal:
sudo apt install gdebi
Once done you can right click on .deb file and select to open it with Gdeb
I face so many issue to install google chrome on Ubuntu 16.04.
finalyl, I successfully install google chrome on ubuntu by following commands:
Step 1: $sudo apt-get install gdebi
Step 2: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Step 3: In same directory where you have download package or give path in command
$sudo gdebi google-chrome-stable_current_amd64.deb
installed chrome successfully.
I had same issue. on running google-chrome from terminal, found that it need new version of NSS. Chrome 62 need NSS>=3.26. So installed libnss3.
$google-chrome
[6999:7036:1113/200616.549496:FATAL:nss_util.cc(632)] NSS_VersionCheck("3.26") failed. NSS >= 3.26 is required. Please upgrade to the latest NSS, and if you still get this error, contact your distribution maintainer.
Aborted (core dumped)
sudo apt-get install --reinstall libnss3
and it worked for me :)

Install perl-JSON on centos

When I'm trying to run a perl script (on my centos 6 machine) I get this message:
Can't locate JSON.pm in #INC (#INC contains:
/usr/local/lib/perl5/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/5.10.1
/usr/local/lib/perl5/site_perl/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.1 .)...
After googling a bit, I found out that I need to install that module; But, when I'm typing:
sudo yum install perl-JSON
I get this message:
...
Setting up Install Process
Package perl-JSON-2.17-1.el5.noarch already installed and latest version
Nothing to do
What can I do in order to run that script?
My perl version is v5.10.1
Thanks,
Try to install it via:
1) CPAN (cpan install)
$ sudo cpan JSON
2) CPAN minus (cpanm)
Install cpan minus
$ wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.5017.tar.gz
$ tar -zxvf App-cpanminus-1.5017.tar.gz
$ cd App-cpanminus-1.5017
$ perl make.pl
$ make
$ make test
$ sudo make install
Then install it via cpanm
$ sudo cpanm JSON
I prefer work with CPAN modules via cpanm, because it's modern and easy way!
Maybe this will help others.
In my case,
running in Centos 7:
yum install cpan
then
yum install cpanminus
for cpan (not cpan minus):
yum install cpan
cpan JSON