昨天鄰居想嘗試使用 Linux,大致上都沒什麼問題,但卡到二個點:
- 輸入法:沒有順手的輸入法 (倉頡)
- Office 文件工具組:LibreOffice 的操作實在很不直覺,從 M$ 跳到 LibreOffice 目前還沒聽過有人說好用的。
軟體開發、伺服器和生活瑣事
昨天鄰居想嘗試使用 Linux,大致上都沒什麼問題,但卡到二個點:
以下幾個參數,在 MySQL 8.0 不在繼續支援、使用:
整理過後,我的 MySQL 8 設定檔如下:
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
default-authentication-plugin = mysql_native_password
performance_schema = Off
default-storage-engine = InnoDB
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
# LOGGING #
log-error = /var/log/mysql/error.log
log-error = /var/lib/mysql/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
binlog_expire_logs_seconds = 86400 # 1 day
max-binlog-cache-size = 4M
max-binlog-size = 128M
# MyISAM #
key-buffer-size = 16M
myisam-recover-options = FORCE,BACKUP
max-allowed-packet = 16M
max-connect-errors = 1000000
# BINARY LOGGING #
server-id = 4782375
log-bin = /var/lib/mysql/mysql-bin
expire-logs-days = 14
sync-binlog = 1
# MyISAM #
key-buffer-size = 16M
myisam-recover-options = FORCE,BACKUP
max-allowed-packet = 16M
max-connect-errors = 1000000
# CACHES AND LIMITS #
tmp-table-size = 16M
max-heap-table-size = 32M
max-connections = 100
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 524288
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-file-per-table = 1
innodb-buffer-pool-size = 16M
innodb-flush-log-at-trx-commit = 1
innodb-log-file-size = 64M
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqldump]
default-character-set = utf8mb4
gist 連結:https://gist.github.com/johnroyer/43f18557ad9ff3070b1d22e7b957f950
因為一個意外,收到了 4000 元的電費帳單,所以決定把目前租屋內的家電用品全部都測量一次耗電量,找出兇手才罷休。
先從我的電腦開始列:
建立 table 時可能會同時建立 foreign key:
$table->foreign('good_id')
->references('id')
->on('goods')
->onDelete('cascade');
$table->index('value');
這個情況下要直接 dropIndex() 是會出現錯誤的,要先把 key constraint 解掉再來刪除 index。
而 constraint key name 用 show index from TABLE 是看不到的,但是可以使用下面的語法看到 create table 時做的事情:
show create table NAME
看到 contrain key name 以後先用 dropForeign() 刪除,再 dropIndex() 即可。
ps. 記得事情處理完以後,要把 constraint 加回去喔
這幾天被 Raspbian 安裝搞得七葷八素,所以乾脆把幾個常用設定改好,直接打包給大家用。
我用的是 Raspbian Buster Lite:
我調整過的設定 (目標是接上電源線即可遠端操作):
載點:https://mega.nz/#F!dR5EVABL!Nkynwg5ivQuRyRqpGz1Q4A
SHA1: 71664d5651d660077621f91b29edeecf4810a486
SHA256: 981a8ded523c30f06ec09292445255c55a862e5d756b4e0fff5f8d069ef35afa