Tag Archives: dba

mongo mongoshell query examples

mongo mongoshell query examples

db.MYTABLE.find()
db.MYTABLE.find({}).count
db.MYTABLE.find({}).limit(10)
db.MYTABLE.find({"name":"a"})
db.MYTABLE.find({"name":"a"},{name:1})
db.MYTABLE.find({"name":"a"}).sort({name:1})
db.MYTABLE.remove({"name":"a"})

 

Advertisements

in #centos 6.x #percona 5.x #phpmyadmin 4.x reads config file from a new directory #dba #devops #sysadmin

in #centos 6.x #percona 5.x #phpmyadmin 4.x reads its config file from a completely different directory – it is no longer in the phpmyadmin code directory

ACTUAL centos 6 percona 5 phpmyadmin 4 config files are as follows

  • phpMyAdmin httpd – /etc/httpd/conf.d/phpMyAdmin.conf
  • phpMyAdmin conf – /etc/phpMyAdmin/config.inc.php
  • phpMyAdmin code – /usr/share/phpMyAdmin/

See also

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 |
+------------------------------------+

#mysql howto convert a database and it tables to #utf8

DUMP
mysqldump -h 127.0.0.1 -uMYUSER –skip-quote-names –skip-comments –skip-extended-insert MYDATABASE > db.sql

MODIFY
mysql > alter database MYDATABASE character set = utf8 collate = utf8_general_ci;

PATCH
sed “s/ENGINE=MyISAM/ENGINE=InnoDB/g” < db.sql > db2.sql
sed “s/DEFAULT CHARSET=latin1;/;/g” < db2.sql > db3.sql
sed “s/CHARACTER SET utf8 COLLATE utf8_bin//g” < db3.sql > db4.sql

.MY.CNF
[client]
default-character-set=utf8

RESTORE
mysql -h 127.0.0.1 -uMYUSER < db4.sql

CHECK NEW SETTINGS
mysql > show variables

| character_set_client                    | utf8                       
| character_set_connection                | utf8                       
| character_set_database                  | utf8                       
| character_set_filesystem                | binary                     
| character_set_results                   | utf8                       
| character_set_server                    | latin1                     
| character_set_system                    | utf8                    
   
| collation_connection                    | utf8_general_ci            
| collation_database                      | utf8_general_ci            
| collation_server                        | latin1_swedish_ci

Refs