Category Archives: MySQL

Installing MySQL on Linux Using the MySQL Yum Repository

Install Guide

http://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html


$ service mysqld start

$ ps ax | grep mysql
 4396 ?        Ss     0:00 /bin/bash /usr/bin/mysql-systemd-start post
 5160 pts/2    S+     0:00 /bin/systemctl start mysqld.service

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

After you installed MySQL-community-server 5.7 from fresh on linux, you will need to find the temporary password from /var/log/mysqld.log to login as root.

grep ‘temporary password’ /var/log/mysqld.log
Run mysql_secure_installation to change new password

When running into error 13 or 12, change SELinux and re-install

SE Linux

http://wiki.centos.org/HowTos/SELinux


$ yum remove mysql spullen

$ sestatus

$ edit se linux configuration to disable SELinux

$ yum -y install mysql-community-server

$ service mysqld start

$ ps ax | grep mysql
 14059 ?        Ss     0:00 /bin/sh /usr/bin/mysqld_safe
14208 ?        Sl     0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
14294 pts/0    S+     0:00 mysql
14585 pts/1    S+     0:00 grep --color=auto mysql

Install Perl DBD::mysql on Oracle Linux/Centos

Install CPAN

yum -y install cpan
cpan App::cpanminus

Install C compiler

[root@yogya ~]# yum -y install cpp

Install MySql developer libraries

[root@yogya mysql-database-stuff]# yum -y install msql-devel

Install DBI and YAML

[root@yogya mysql-database-stuff]# cpan DBI
[root@yogya mysql-database-stuff]# cpan
cpan[2]> install YAML

Om de een of andere reden lukt installeren van DBD::mysql niet met CPAN.
Dus MySql installation from source. Download source distro.

http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql/INSTALL.pod#Manual_installation


[root@yogya ~]# wget http://cpan.metacpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz
[root@yogya ~]# gunzip DBD-mysql-4.028.tar.gz
[root@yogya ~]# tar xvf DBD-mysql-4.028.tar 
[root@yogya ~]# cd DBD-mysql-4.028

Maak even de test database en zet een password voor de root user

mysql> create database test;
mysql> use mysql;
mysql> update user set password = password ( 's3kr1t' ) where user = 'root'

Make sure options match, dus kijk even wat je in moet vullen om de Makefile te bouwen met.

[root@yogya DBD-mysql-4.028]# perl Makefile.PL --help
Usage: perl Makefile.PL [options]

Possible options are:

--cflags= Use for running the C compiler; defaults
to the value of "mysql_config --cflags" or a guessed
value
--libs= Use for running the linker; defaults
to the value of "mysql_config --libs" or a gussed
value
--force-embedded Build version of driver supporting mysqlEmb
--embedded= Use these libs when building the embedded version of
DBD (with --force-embedded). Defaults to the value of
"mysql_config --embedded".
--testdb= Use the database for running the test suite;
defaults to test
--testuser= Use the username for running the test suite;
defaults to no username
--testpassword= Use the password for running the test suite;
defaults to no password
--testhost= Use as a database server for running the
test suite; defaults to localhost.
--testport= Use as the port number of the database;
by default the port number is choosen from the
mysqlclient library
--mysql_config= Specify for mysql_config script
--with-mysql= Specify for the root of the MySQL installation.
--nocatchstderr Supress using the "myld" script that redirects
STDERR while running the linker.
--nofoundrows Change the behavior of $sth->rows() so that it
returns the number of rows physically modified
instead of the rows matched
--ps-protocol Toggle the use of driver emulated prepared statements
prepare, requires MySQL server >= 4.1.3 for
server side prepared statements, off by default
--bind-type-guessing Toggle the use of driver attribute mysql_bind_type_guessing
This feature makes it so driver-emulated prepared statements
try to "guess" if a value being bound is numeric, in which
case, quotes will not be put around the value.
--ssl Enable SSL support
--help Print this message and exit

All options may be configured on the command line. If they are
not present on the command line, then mysql_config is called (if
it can be found):

mysql_config --cflags
mysql_config --libs
mysql_config --embedded
mysql_config --testdb

and so on. See DBD::mysql::INSTALL for details.

Finish installation. In dit geval hoef je alleen het password op te geven.


[root@yogya DBD-mysql-4.028]# perl Makefile.PL --testpassword=s3kr1t
[root@yogya DBD-mysql-4.028]# make
[root@yogya DBD-mysql-4.028]# make test
[root@yogya DBD-mysql-4.028]# make install

					

perl DBD::mysql Mac OS X 10.8.5

At the moment of this writing there is no MySQL for Mac OS X 10.8, instead use the MySql for 10.7.

When trying to open a connection via Perl the system complains about dylib not being installed in the right place.

su root
find / -name "libmysqlclient.18.dylib" -print 
cp /usr/local/mysql-5.6.14-osx10.7-x86_64/lib/libmysqlclient.18.dylib /usr/lib