lastfile=`tail -n 1 mysql-bin.index`
echo $lastfile
Thursday, February 24, 2011
mysql backup a table / duplicate a table
mysql> create table compounds_201110223 like compounds;
Query OK, 0 rows affected (0.00 sec)
mysql> insert compounds_201110223 select * from compounds;
Query OK, 0 rows affected (0.00 sec)
mysql> insert compounds_201110223 select * from compounds;
Wednesday, February 23, 2011
mysql insert ignore on duplicate key
INSERT IGNORE INTO all_cas (CAS, sid, source)
( SELECT DISTINCT(cas), mid, 4 FROM chemmolpharm.compounds WHERE cas REGEXP '[0-9]{2,7}-[0-9]{1,2}-[0-9]{1}' );
( SELECT DISTINCT(cas), mid, 4 FROM chemmolpharm.compounds WHERE cas REGEXP '[0-9]{2,7}-[0-9]{1,2}-[0-9]{1}' );
mysql "ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)"
issue:
mysql "ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)"
Solution
Restart mysql server
root@cm-test:~# service mysql stop
root@cm-test:~# service mysql start
mysql "ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)"
Solution
Restart mysql server
root@cm-test:~# service mysql stop
root@cm-test:~# service mysql start
ls ll with regular express
#!/bin/bash
for f in $(ls | egrep 'mysql-bin.0[0-9]{5}$')
do
echo "process file: $f"
done
[root@localhost recovery]# ll mysql-bin.0[0-9][0-9][0-9][0-9][0-9]
-rw-r----- 1 root root 23022429 Feb 23 06:13 mysql-bin.000001
-rw-r----- 1 root root 456769 Feb 23 06:13 mysql-bin.000002
-rw-r----- 1 root root 47295 Feb 23 06:13 mysql-bin.000003
-rw-r----- 1 root root 679680 Feb 23 06:13 mysql-bin.000004
-rw-r----- 1 root root 1742441 Feb 23 06:13 mysql-bin.000005
-rw-r----- 1 root root 5671825 Feb 23 06:13 mysql-bin.000006
-rw-r----- 1 root root 5588178 Feb 23 06:13 mysql-bin.000007
-rw-r----- 1 root root 5312684 Feb 23 06:13 mysql-bin.000008
-rw-r----- 1 root root 5569825 Feb 23 06:13 mysql-bin.000009
-rw-r----- 1 root root 5653535 Feb 23 06:13 mysql-bin.000010
-rw-r----- 1 root root 5361382 Feb 23 06:13 mysql-bin.000011
-rw-r----- 1 root root 5722384 Feb 23 06:13 mysql-bin.000012
-rw-r----- 1 root root 5759352 Feb 23 06:13 mysql-bin.000013
-rw-r----- 1 root root 6006372 Feb 23 06:13 mysql-bin.000014
-rw-r----- 1 root root 5645165 Feb 23 06:13 mysql-bin.000015
-rw-r----- 1 root root 5508167 Feb 23 06:13 mysql-bin.000016
-rw-r----- 1 root root 6258305 Feb 23 06:13 mysql-bin.000017
-rw-r----- 1 root root 5959473 Feb 23 06:13 mysql-bin.000018
-rw-r----- 1 root root 5743501 Feb 23 06:13 mysql-bin.000019
-rw-r----- 1 root root 5618976 Feb 23 06:13 mysql-bin.000020
-rw-r----- 1 root root 4157667 Feb 23 06:13 mysql-bin.000021
[root@localhost recovery]# ll | egrep "mysql-bin.0[0-9]{5}$"
-rw-r----- 1 root root 23022429 Feb 23 06:13 mysql-bin.000001
-rw-r----- 1 root root 456769 Feb 23 06:13 mysql-bin.000002
-rw-r----- 1 root root 47295 Feb 23 06:13 mysql-bin.000003
-rw-r----- 1 root root 679680 Feb 23 06:13 mysql-bin.000004
-rw-r----- 1 root root 1742441 Feb 23 06:13 mysql-bin.000005
-rw-r----- 1 root root 5671825 Feb 23 06:13 mysql-bin.000006
-rw-r----- 1 root root 5588178 Feb 23 06:13 mysql-bin.000007
-rw-r----- 1 root root 5312684 Feb 23 06:13 mysql-bin.000008
-rw-r----- 1 root root 5569825 Feb 23 06:13 mysql-bin.000009
-rw-r----- 1 root root 5653535 Feb 23 06:13 mysql-bin.000010
-rw-r----- 1 root root 5361382 Feb 23 06:13 mysql-bin.000011
-rw-r----- 1 root root 5722384 Feb 23 06:13 mysql-bin.000012
-rw-r----- 1 root root 5759352 Feb 23 06:13 mysql-bin.000013
-rw-r----- 1 root root 6006372 Feb 23 06:13 mysql-bin.000014
-rw-r----- 1 root root 5645165 Feb 23 06:13 mysql-bin.000015
-rw-r----- 1 root root 5508167 Feb 23 06:13 mysql-bin.000016
-rw-r----- 1 root root 6258305 Feb 23 06:13 mysql-bin.000017
-rw-r----- 1 root root 5959473 Feb 23 06:13 mysql-bin.000018
-rw-r----- 1 root root 5743501 Feb 23 06:13 mysql-bin.000019
-rw-r----- 1 root root 5618976 Feb 23 06:13 mysql-bin.000020
-rw-r----- 1 root root 4157667 Feb 23 06:13 mysql-bin.000021
for f in $(ls | egrep 'mysql-bin.0[0-9]{5}$')
do
echo "process file: $f"
done
[root@localhost recovery]# ll mysql-bin.0[0-9][0-9][0-9][0-9][0-9]
-rw-r----- 1 root root 23022429 Feb 23 06:13 mysql-bin.000001
-rw-r----- 1 root root 456769 Feb 23 06:13 mysql-bin.000002
-rw-r----- 1 root root 47295 Feb 23 06:13 mysql-bin.000003
-rw-r----- 1 root root 679680 Feb 23 06:13 mysql-bin.000004
-rw-r----- 1 root root 1742441 Feb 23 06:13 mysql-bin.000005
-rw-r----- 1 root root 5671825 Feb 23 06:13 mysql-bin.000006
-rw-r----- 1 root root 5588178 Feb 23 06:13 mysql-bin.000007
-rw-r----- 1 root root 5312684 Feb 23 06:13 mysql-bin.000008
-rw-r----- 1 root root 5569825 Feb 23 06:13 mysql-bin.000009
-rw-r----- 1 root root 5653535 Feb 23 06:13 mysql-bin.000010
-rw-r----- 1 root root 5361382 Feb 23 06:13 mysql-bin.000011
-rw-r----- 1 root root 5722384 Feb 23 06:13 mysql-bin.000012
-rw-r----- 1 root root 5759352 Feb 23 06:13 mysql-bin.000013
-rw-r----- 1 root root 6006372 Feb 23 06:13 mysql-bin.000014
-rw-r----- 1 root root 5645165 Feb 23 06:13 mysql-bin.000015
-rw-r----- 1 root root 5508167 Feb 23 06:13 mysql-bin.000016
-rw-r----- 1 root root 6258305 Feb 23 06:13 mysql-bin.000017
-rw-r----- 1 root root 5959473 Feb 23 06:13 mysql-bin.000018
-rw-r----- 1 root root 5743501 Feb 23 06:13 mysql-bin.000019
-rw-r----- 1 root root 5618976 Feb 23 06:13 mysql-bin.000020
-rw-r----- 1 root root 4157667 Feb 23 06:13 mysql-bin.000021
[root@localhost recovery]# ll | egrep "mysql-bin.0[0-9]{5}$"
-rw-r----- 1 root root 23022429 Feb 23 06:13 mysql-bin.000001
-rw-r----- 1 root root 456769 Feb 23 06:13 mysql-bin.000002
-rw-r----- 1 root root 47295 Feb 23 06:13 mysql-bin.000003
-rw-r----- 1 root root 679680 Feb 23 06:13 mysql-bin.000004
-rw-r----- 1 root root 1742441 Feb 23 06:13 mysql-bin.000005
-rw-r----- 1 root root 5671825 Feb 23 06:13 mysql-bin.000006
-rw-r----- 1 root root 5588178 Feb 23 06:13 mysql-bin.000007
-rw-r----- 1 root root 5312684 Feb 23 06:13 mysql-bin.000008
-rw-r----- 1 root root 5569825 Feb 23 06:13 mysql-bin.000009
-rw-r----- 1 root root 5653535 Feb 23 06:13 mysql-bin.000010
-rw-r----- 1 root root 5361382 Feb 23 06:13 mysql-bin.000011
-rw-r----- 1 root root 5722384 Feb 23 06:13 mysql-bin.000012
-rw-r----- 1 root root 5759352 Feb 23 06:13 mysql-bin.000013
-rw-r----- 1 root root 6006372 Feb 23 06:13 mysql-bin.000014
-rw-r----- 1 root root 5645165 Feb 23 06:13 mysql-bin.000015
-rw-r----- 1 root root 5508167 Feb 23 06:13 mysql-bin.000016
-rw-r----- 1 root root 6258305 Feb 23 06:13 mysql-bin.000017
-rw-r----- 1 root root 5959473 Feb 23 06:13 mysql-bin.000018
-rw-r----- 1 root root 5743501 Feb 23 06:13 mysql-bin.000019
-rw-r----- 1 root root 5618976 Feb 23 06:13 mysql-bin.000020
-rw-r----- 1 root root 4157667 Feb 23 06:13 mysql-bin.000021
mysql show variables
mysql> show variables like '%bin%';
+-----------------------------------------+------------+
| Variable_name | Value |
+-----------------------------------------+------------+
| binlog_cache_size | 32768 |
| binlog_direct_non_transactional_updates | OFF |
| binlog_format | MIXED |
| innodb_locks_unsafe_for_binlog | OFF |
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_bin_trust_routine_creators | OFF |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| sql_log_bin | ON |
| sync_binlog | 0 |
+-----------------------------------------+------------+
11 rows in set (0.00 sec)
+-----------------------------------------+------------+
| Variable_name | Value |
+-----------------------------------------+------------+
| binlog_cache_size | 32768 |
| binlog_direct_non_transactional_updates | OFF |
| binlog_format | MIXED |
| innodb_locks_unsafe_for_binlog | OFF |
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_bin_trust_routine_creators | OFF |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| sql_log_bin | ON |
| sync_binlog | 0 |
+-----------------------------------------+------------+
11 rows in set (0.00 sec)
Subscribe to:
Posts (Atom)
-
Step 1, New a project rails new demo Step 2, Update Gemfile add paperclip, mysql2 gem, enable JavaScript runtime gem 'mysql2' ...
-
When trying to access transmission from web-browswer i got the message : 403: Forbidden Unauthorized IP Address. Either disable the IP ad...