iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >mysql启动停止 以及基本使用,乱码处理
  • 888
分享到

mysql启动停止 以及基本使用,乱码处理

2024-04-02 19:04:59 888人浏览 安东尼
摘要

1)可以使用解压版本直接解压:比如Mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz2)将准备好的my.cnf(该文件可以通过mysql目录下的support-files目录下

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 <create-table.sql
或者进入mysqlshell
mysql> source /home/bes/mysql.sql

您可能感兴趣的文档:

--结束END--

本文标题: mysql启动停止 以及基本使用,乱码处理

本文链接: https://www.lsjlt.com/news/36362.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作