mysql啟動停止 以及基本使用,亂碼處理
2)將準備好的my.cnf(該文件可以通過mysql目錄下的support-files目錄下的my_default.cnf復制過來,然後在裏面添加一些參數)放到 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
#*** upgrade to a newer version of MySQL.
[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%.
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
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)初始化數據,會生成一個root@localhost的賬號,密碼為空
br/>innodb_print_all_deadlocks=1
log-error=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/error.err
具體修改安裝目錄即可
3)初始化數據,會生成一個root@localhost的賬號,密碼為空
目錄下面會出現data目錄;服務並沒有啟動
4)bin/mysqld --defaults-file=${MYSQl_NAME}/my.cnf 啟動服務
5)然後使用命令修改用戶名密碼
bin/mysqladmin -uroot password‘123456‘ --socket=mysql.sock
6)會用命令登錄
bin/mysql --socket=./mysql.sock -uroot -p‘123456‘
正常訪問即可
7)數據庫備份
bin/mysqldump -uroot -p123456 -h192.168.0.70 Webgate >./backup.sql
還原:
bin/mysqldump -uroot -p123456 -h192.168.0.70 Webgate <./backup.sql
8)mysql編碼
如果 表中有中文字符,需要註意編碼問題
首先執行環境下的編碼格式為:export LANG=zh_CN.UTF8
然後修改:my.cnf中配置文件:
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
9)執行sql文件有兩種方式
bin/mysql -uroot -p123456 --socket=./mysql.sock <create-table.sql
或者進入mysqlshell
mysql> source /home/bes/mysql.sql
mysql啟動停止 以及基本使用,亂碼處理