Category Archives: Sử dụng máy vi tính

ERROR 2006 (HY000): MySQL server has gone away

I have one file x.sql (size about 7M)
It’s content is only one line (query insert multiple rows), like that
INSERT INTO yume(name, title) VALUES (‘-khung_long-‘, ‘-khung_long-‘),(‘0313577642’, ‘tinh_xa_vang_1981’),….

I used mysql client to import data via command
mysql> source C:\Documents and Settings\LNV\Desktop\tmp\yume\logs\x.sql
But I got error
ERROR 2006 (HY000): MySQL server has gone away

Solved:
In my.ini (MySQL Server configuration file)

my.ini configuration

my.ini configuration

Thằng nào đang SSH, anh kích

#Thêm vào alias lần sau gõ cho tiện
vim ~/.bash_profile
alias whossh='ps aux | grep -E "(sshd.*pts)" | awk '"'"'{print $2, "\t" , $9, "\t", $12}'"'"' | grep "pts"'

#Cập nhật alia mới thêm nào
source ~/.bash_profile

#Sử dụng alia đã tạo, xem danh sách các chú đang SSH
whossh

#Lấy PID và xử chú nào đó thôi
kill XXX

One my batch script

File: C:\command-line\checkphp.bat
@echo off
cls
REM Luu thong tin o dia va thu muc dang lam viec
set odia=%cd:~0,2%
set thumuc=%cd%

REM Chuyen sang o dia va thuc muc chua batch script
%~d0
cd %~dp0

REM Lam mot so thu…
REM php -d “include_path=\”C:\;C:\var\includes;C:\var\www\includes\”” -r “print ini_get(‘include_path’);”
php –ini
php -r “define(‘ENTER’, \”\n\”); print ‘Include Path: ‘ . ini_get(‘include_path’); echo ENTER; echo (function_exists(‘curl_init’)) ? ‘cURL is available’: ‘cURL is unavailable’; echo ENTER; echo (function_exists(‘imagecreatefrompng’)) ? ‘Image Processing GD is available’ : ‘Image Processing GD is unavailable’; ”

REM Quay tro lai o dia va thu muc dang lam viec ban dau
%odia%
cd %thumuc%

Set thêm biến môi trường C:\command-line\ vào trong PATH (chuột phải My Computer, Properties, Advanced, Environment Variables, System variables, Path)

Run
cmd
checkphp

Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\xampplite\php\php-cli.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Include Path: .;C:\xampplite\php\pear
cURL is available
Image Processing GD is available

Lâu lâu review tí lệnh Linux

Hiển thị 10 dòng đầu tiên của file
head -10 ~./bash_profile

Hiển thị 10 dòng cuối của file
head -10 ~./bash_profile

Bài toán cho bạn: :p
Kết hợp head, tail hiển thị dòng thứ n của một file ;))
Kết hợp head, tail hiển thị L(limit) dòng từ dòng thứ O(offset) của một file ;))

alias xxx=’echo “I love you”‘
xxx

vim ~/.bash_profile
Thêm dòng
alias seelog=’tail -f /var/log/message’
Để alias có hiệu lực luôn
source ~/.bash_profile
Giờ thì gõ
seelog

vim
:x = :wq (lưu và thoát)
:10 (nhảy tới dòng số 10)