登入mysql檢視用show variables like 『character%』;下字符集,顯示如下:
| 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 |
| character_sets_dir | /usr/share/mysql/charsets/ |
解決方案:
1、在[client]欄位裡加入default-character-set=utf8
2、在[mysqld]欄位裡加入character-set-server=utf8
3、在[mysql]欄位裡加入default-character-set=utf8
修改完成後,service mysql restart重啟mysql服務就生效。注意:[mysqld]欄位與[mysql]欄位是有區別的。
最終結果如下:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8
[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
character-set-server=utf8
# instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
log-error = /var/log/mysql/error.log
# disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# * important: additional settings that can override those from this file!
# the files must end with '.cnf', otherwise they'll be ignored.
#!includedir /etc/mysql/conf.d/
[mysql]
no-auto-rehash
default-character-set=utf8
在丟失root密碼的時候,可以這樣
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> update user set password=password("new password") where user='root';
mysql> flush privileges;
the server quit without updating pid file
只需要執行scripts/mysql_install_db --user=mysql
libaio.so.1: cannot open shared object file
執行sudo apt-get install libaio-dev
或sudo apt-get install libaio1
utf8編碼設定在mysql/my.cnf中到[mysqld]下
[mysqld]
init_connect='set collation_connection = utf8_unicode_ci'
init_connect='set names utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
定製ubuntu14 4系統
實驗了網上介紹的remastersys,utk等,有些找不到安裝包,有些不再支援,有些定製不夠徹底,有些製作的iso檔案不能用。最後找到以下方法可以用,介紹如下。主要還是ubuntu官網上的介紹。附上參考網頁 1,安裝必要的工具 sudoapt install squashfs tools geni...
Ubuntu14 4更改執行級別
據說ubunut的乙個ui相對友好的linux版本,但我的需求是僅僅將其作為伺服器使用,偶爾用用ui介面。所以我希望啟動ubuntu時,直接進入shell命令列。印象中,linux可以通過修改runlevel來改變啟動級別,以達到我上述目的。但ubuntu卻顯得有點特別。先說方案 檢視當前啟動級別 ...
ubuntu14 4開啟ftp服務
1 更新源列表 開啟 終端視窗 輸入 sudo apt get update 回車 輸入當前登入使用者的管理員密碼 回車,就可以了。2 安裝vsftpd 開啟 終端視窗 輸入 sudo apt get install vsftpd 回車 安裝完成。3 新建 home uftp 目錄作為使用者主目錄 ...