Tag Archives: mysql

mariadb, mysql and percona 5.5 general query and slow query logging

mariadb, mysql and percona 5.5 general query and slow query logging

mysql> select @@general_log;
+---------------+
| @@general_log |
+---------------+
|             1 |
+---------------+


mysql> select @@general_log_file;
+-------------------------------+
| @@general_log_file            |
+-------------------------------+
| /var/lib/mysql/data/query.log |
+-------------------------------+


mysql> select  @@slow_query_log;
+------------------+
| @@slow_query_log |
+------------------+
|                1 |
+------------------+


mysql> select @@slow_query_log_file;
+------------------------------------+
| @@slow_query_log_file              |
+------------------------------------+
| /var/lib/mysql/data/mysql-slow.log |
+------------------------------------+
Advertisements

#php #mysql #pdo prepare and single quotes #gotcha

i suspect that php pdo prepare may be double escaping single quotes in your sql string so replace single quotes with double quotes

FAILS

$sql = <<<EOT
    select * from cars where colour='red'
EOT;
$stm = $db->prepare($sql);

WORKS

$sql = <<<EOT
    select * from cars where colour="red"
EOT;
$stm = $db->prepare($sql);

cent/ouek/rhel 6.x linux 2.x nginx 1.x php 5.x phpmyadmin 4 install howto

cent/ouek/rhel linux nginx php phpmyadmin install is NOT easy !

see http://twiwoo.com/php/how-to-install-nginx-php-fpm-on-centos-6/

first add epel repo then

yum install nginx
yum install php-fpm
yum install phpmyadmin

fix major problem with default php install the MISSING session subdir

cd /var/lib/php
mkdir session
chown nginx:nginx session change apache to nginx

vi /etc/php-fpm.d/www.conf change apache to nginx

; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

start services

service nginx start
service php-fpm start

ubuntu 14.04 (trusty) percona 5 install howto

https://www.percona.com/doc/percona-server/5.5/installation/apt_repo.html

howto switch from mysql 5 to percona 5 on ubuntu 14.04 trusty

remove mysql (if youve already installed it)

# aptitude remove mysql-client-5.5 mysql-client-core-5.5 mysql-workbench

install percona

# apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
# vi /etc/apt/sources.list

  deb http://repo.percona.com/apt trusty main
  dpkg http://repo.percona.com/apt trusty main
  
# aptitude update
# aptitude install percona-server-client-5.5 percona-server-server-5.5

ubuntu mariadb 5.5 doesnt install with mysql 5.6 libraries

uninstall mysql 5.6 and force install of older version of mysql

see old versions available
# aptitude versions mysql-common

force older version of mysql
# aptitude install mysql-common=5.5.41-0ubuntu0.14.04.1

prevent mysql-common updating (hold it via '=')
# aptitude install mysql-common=

install mariadb
# aptitude install mariadb-server

verify

# dpkg -l | grep ii | egrep "mysql|maria"
ii  libmariadbclient18:amd64                  5.5.41-1ubuntu0.14.04.1                  amd64        MariaDB database client library
ii  libmysqlclient18:amd64                    5.5.41-0ubuntu0.14.04.1                  amd64        MySQL database client library
ii  mariadb-client-5.5                        5.5.41-1ubuntu0.14.04.1                  amd64        MariaDB database client binaries
ii  mariadb-client-core-5.5                   5.5.41-1ubuntu0.14.04.1                  amd64        MariaDB database core client binaries
ii  mariadb-common                            5.5.41-1ubuntu0.14.04.1                  all          MariaDB common metapackage
ii  mariadb-server                            5.5.41-1ubuntu0.14.04.1                  all          MariaDB database server (metapackage depending on the latest version)
ii  mariadb-server-5.5                        5.5.41-1ubuntu0.14.04.1                  amd64        MariaDB database server binaries
ii  mariadb-server-core-5.5                   5.5.41-1ubuntu0.14.04.1                  amd64        MariaDB database core server files
ii  mysql-apt-config                          0.3.3-2ubuntu14.04                       all          Auto configuration for MySQL APT Repo.
ii  mysql-common                              5.5.41-0ubuntu0.14.04.1                  all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-workbench-community                 6.2.5-1ubu1404                           amd64        MySQL Workbench
ii  php5-mysql                                5.5.9+dfsg-1ubuntu4.7                    amd64        MySQL module for php5