mysql常用命令
Posted Alex·G
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql常用命令相关的知识,希望对你有一定的参考价值。
set env
db_host=136.198.111.110
db_password=db.3NIoTP7
db_port=3081
db_user=order
db_name=order_from
db_table=product
备份表
mysqldump -h${db_host} -u${db_user} -p${db_password} -P${db_port} ${db_name} ${db_table} > /tmp/${db_table}_`date +%F-%H-%M-%S`.sql
create table ${db_table}.bak select id,modified,bid,status from ${db_table} limit 100;
还原表
mysql -h${db_host} -u${db_user} -p${db_password} -P${db_port} ${db_name} < /tmp/${db_table}.sql
mysql -h${db_host} -u${db_user} -p${db_password} -P${db_port} ${db_name}; source /tmp/${db_table}.sql
mysql.cnf
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8
以上是关于mysql常用命令的主要内容,如果未能解决你的问题,请参考以下文章