mysql启动停止 以及基本使用,乱码处理
admin
2023-04-24 11:43:22
0

1)可以使用解压版本直接解压:比如mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
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
#
default location during install, and will be replaced if you
#*** 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%.
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)初始化数据,会生成一个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 -h292.168.0.70 Webgate >./backup.sql
还原:
bin/mysqldump -uroot -p123456 -h292.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 或者进入mysqlshell
mysql> source /home/bes/mysql.sql

相关内容

热门资讯

烈焰熊熊,堪比“原子弹”,欧洲... 据美国有线电视新闻网(CNN)7月29日报道,席卷法国西南部的大片野火燃烧得如此猛烈,以至于形成了一...
外交部:对日本熊本县地震遇难者... 据凤凰卫视报道,针对日本熊本县发生强震造成人员伤亡,中国外交部发言人毛宁7月29日在例行记者会上表示...
高铁喧哗被劝阻后叫嚣全家体制内... “女子高铁喧哗被劝阻后叫嚣全家体制内”一事迎来官方通报。据新京报报道,7月29日,辽宁北票市公安局发...
广东专业蓝牙耳机定制厂家推荐,... 在珠三角腹地,广东早已成为全球蓝牙耳机产业链的“心脏地带”。从深圳华强北的声学元件批发,到东莞、惠州...
格雷厄姆葬礼变地缘竞价场!两大... 有些葬礼,送别的是逝者;有些葬礼,演的却是活人最现实的政治博弈。当地时间7月28日,美国老牌鹰派参议...
一道小学数学题难住3名医学博士... 3名不同学校的博士同做一道数学题,谁最厉害?近日,一陕西网友发布的视频引发热议。29日,视频发布者“...
华为全新“小艺任务”亮相:整合... 7月29日,在华为鸿蒙电脑新品技术沟通会上,终端云服务小艺业务部总裁贾永利宣布,小艺将迎来“从对话到...
广西日报特稿《王的猜想》火了,... 澎湃新闻记者 蒋子文 实习生 汤煜炜为应对外界购买纸质版特稿《王的猜想》的热情,《广西日报》宣布紧急...
月租20元内!2026年平价云... 不少手游玩家、账号运营从业者挑选云手机时,首要诉求就是低价够用,想要控制每月支出在20元以内,同时兼...
诺奖得主如何看待王虹境遇?“我... 中村修二(2014年诺贝尔物理学奖得主)【导读】近日王虹与邓煜双双获得2026年菲尔兹奖,成为了首批...