Friday, August 26, 2016

MySQL - Case sensitive for database name in Windows

Hi there! I'm have problem on my windows machine with LAMP stack environment to maintenance existing web system that has been deploy on Linux server. I create a copy of database and import on my local MySQL. The original database consist of lowercase and uppercase letter database name but when after imported it convert to lowercase database name that causing stupid mess error and waste lot of time!

I about MySQL collation of insensitive case and sensitive case but it seem valid on tables only, not the database name itself. I figure a work around to force MySQL on windows to store it on disk with case sensitive names.

Open you MySQL location folder and open my.ini file, insert lower_case_table_names=2 and restart the MySQL service. Done!

Friday, August 12, 2016

MySQL / MariaDB - Show warning details

mysql> flush privileges;                                                 
Query OK, 0 rows affected, 5 warnings (0.08 sec)                         
                                                                         
mysql> \w;                                                               
Show warnings disabled.                                                  
ERROR:                                                                   
No query specified                                                       
                                                                         
mysql> show warnings;                                                    
+---------+------+-------------------------------------+                 
| Level   | Code | Message                             |                 
+---------+------+-------------------------------------+                 
| Warning | 1292 | Truncated incorrect time value: 'N' |                 
| Warning | 1292 | Truncated incorrect time value: 'N' |                 
| Warning | 1292 | Truncated incorrect time value: 'N' |                 
| Warning | 1292 | Truncated incorrect time value: 'N' |                 
| Warning | 1292 | Truncated incorrect time value: 'N' |                 
+---------+------+-------------------------------------+                 
5 rows in set (0.00 sec)

Tuesday, August 9, 2016

CodeIgniter - htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

Friday, July 22, 2016

Fedora - Checking boot time, verify journal log, calculate journal log size and clean logs

$ systemd-analyze
Startup finished in 1.569s (kernel) + 5.077s (initrd) + 1min 36.483s (userspace) = 1min 43.131s

$ systemd-analyze blame
     1min 8.481s plymouth-quit-wait.service
         51.288s dnf-makecache.service
         10.577s systemd-udev-settle.service
          9.210s dev-sdb6.device
          8.583s systemd-journal-flush.service
          8.491s libvirtd.service
          7.880s firewalld.service

$ journalctl --disk-usage
Archived and active journals take up 656.1M on disk.

$ du -sh  /var/log/journal
657M    /var/log/journal

$ journalctl --verify
000000: Invalid tail monotonic timestamp                                                                                                             
File corruption detected at /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@e19a1761a0fc4727890e4fa88254cb1f-0000000000000786-0005359d746a34ff.journal:6502ed0 (of 109051904 bytes, 97%).
FAIL: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@e19a1761a0fc4727890e4fa88254cb1f-0000000000000786-0005359d746a34ff.journal (Bad message)
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@08b143a153724281a97d3e93b86c3eef-0000000000000001-0005373c30e6e1be.journal            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341267b01ae6-23ce9c5d42e3dba7.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341ebbbf8870-02b44febe18a6235.journal~                                            
5aa8278: Unused data (entry_offset==0)                                                                                                               
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005345c23726fd6-d4b9e97e2b2c7246.journal~                                         
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005345c1bfe8603-b0df6d6afd47b76d.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005370259dbb3e2-cdd6e212043dc4bf.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005357801a4efc4-2a7a09659026f270.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000.journal                                                                            
000000: Invalid tail monotonic timestamp                                                                                                             
File corruption detected at /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@000537357ccb5cc8-168a8bb731df29f9.journal~:ee6b38 (of 16777216 bytes, 93%).
FAIL: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@000537357ccb5cc8-168a8bb731df29f9.journal~ (Bad message)
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005359d7468c197-df87dd623a6a7deb.journal~                                         
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system.journal                                                                               
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341ec7e54f38-1ff1cfcb111bc56b.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005357804ffa241-e7dc957cecea3ba5.journal~                                         
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005359d6fa407a3-8e3c6afba238749a.journal~                                            
PASS: /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@000533ab149fbd05-2893f465d26bbe5a.journal~     

$ ls /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/* 
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@000533ab149fbd05-2893f465d26bbe5a.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341267b01ae6-23ce9c5d42e3dba7.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341ebbbf8870-02b44febe18a6235.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005341ec7e54f38-1ff1cfcb111bc56b.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005345c1bfe8603-b0df6d6afd47b76d.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005357801a4efc4-2a7a09659026f270.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005359d6fa407a3-8e3c6afba238749a.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@0005370259dbb3e2-cdd6e212043dc4bf.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@000537357ccb5cc8-168a8bb731df29f9.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system@08b143a153724281a97d3e93b86c3eef-0000000000000001-0005373c30e6e1be.journal
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/system.journal
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005345c23726fd6-d4b9e97e2b2c7246.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005357804ffa241-e7dc957cecea3ba5.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@0005359d7468c197-df87dd623a6a7deb.journal~
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000@e19a1761a0fc4727890e4fa88254cb1f-0000000000000786-0005359d746a34ff.journal
/var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/user-1000.journal

$ sudo rm -rf /var/log/journal/0cfa1379b4e94fd4bd1cdc4bb20a8a25/*