mysql啟動(dòng)停止以及基本使用,亂碼處理-創(chuàng)新互聯(lián)

1)可以使用解壓版本直接解壓:比如mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
2)將準(zhǔn)備好的my.cnf(該文件可以通過(guò)mysql目錄下的support-files目錄下的my_default.cnf復(fù)制過(guò)來(lái),然后在里面添加一些參數(shù))放到 mysql解壓目錄下
my.cnf具體為:
#For advice on how to change settings please see
#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# DO NOT EDIT THIS FILE. It's a template which will be copied to the
#
default location during install, and will be replaced if you
#*** upgrade to a newer version of MySQL.

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的青原網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
Remove leading # and set to the amount of RAM for the most important data
#cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
skip-host-cache
skip-name-resolve
lower_case_table_names=1

#Remove leading # to turn on a very important data integrity option: logging
changes to the binary log between backups.
#log_bin

#These are commonly set, remove the # and set as required.
basedir =/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64
datadir =/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/data
socket=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/mysql.sock
port =3306
#server_id =

Remove leading # to set options mainly useful for reporting servers.
The server defaults are faster for transactions and fast SELECTs.
Adjust sizes as needed, experiment to find the optimal values.
joinbuffersize = 128M
sortbuffersize = 2M
readrndbuffersize = 2M**
max_connections=1000
max_allowed_packet=1073741824
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

innodb_locks_unsafe_for_binlog=1innodb_print_all_deadlocks=1
log-error=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/error.err
具體修改安裝目錄即可
3)初始化數(shù)據(jù),會(huì)生成一個(gè)root@localhost的賬號(hào),密碼為空
br/>innodb_print_all_deadlocks=1
log-error=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/error.err
具體修改安裝目錄即可
3)初始化數(shù)據(jù),會(huì)生成一個(gè)root@localhost的賬號(hào),密碼為空
目錄下面會(huì)出現(xiàn)data目錄;服務(wù)并沒(méi)有啟動(dòng)
4)bin/mysqld --defaults-file=${MYSQl_NAME}/my.cnf 啟動(dòng)服務(wù)
5)然后使用命令修改用戶名密碼
bin/mysqladmin -uroot password'123456' --socket=mysql.sock
6)會(huì)用命令登錄
bin/mysql --socket=./mysql.sock -uroot -p'123456'
正常訪問(wèn)即可
7)數(shù)據(jù)庫(kù)備份
bin/mysqldump -uroot -p123456 -h292.168.0.70 Webgate >./backup.sql
還原:
bin/mysqldump -uroot -p123456 -h292.168.0.70 Webgate <./backup.sql
8)mysql編碼
如果 表中有中文字符,需要注意編碼問(wèn)題
首先執(zhí)行環(huán)境下的編碼格式為:export LANG=zh_CN.UTF8
然后修改:my.cnf中配置文件:
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
9)執(zhí)行sql文件有兩種方式
bin/mysql -uroot -p123456 --socket=./mysql.sock <create-table.sql
或者進(jìn)入mysqlshell
mysql> source /home/bes/mysql.sql

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

分享名稱:mysql啟動(dòng)停止以及基本使用,亂碼處理-創(chuàng)新互聯(lián)
本文來(lái)源:http://muchs.cn/article12/cspcgc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司、手機(jī)網(wǎng)站建設(shè)、Google、App設(shè)計(jì)、網(wǎng)站策劃、ChatGPT

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)