Mysql命令行导入sql数据的代码
Mysql命令行导入sql数据的实现方法是我们经常会用到的,下面就为你详细介绍Mysql命令行导入sql数据的方法步骤,希望对您学习Mysql命令行方面能有所帮助。
我的个人实践是:phpmyadmin 导出 utf-8 的 insert 模式的 abc.sqlftp abc.sql 到服务器
ssh 到服务器
mysql -u abc -p
use KKK(数据库名,如果没有就 create database KKK)
set names 'utf8'
source abc.sql
注意:我看到 set character set utf8; 的说法,那样不行,中文乱码。
1.首先在命令行控制台中打开mysql
或许命令的如下:
mysql -u root -p database_name
然后或许会提示输入对应的密码
2.下面这条命令或许对你有用,当你想更换一个数据库的时候
mysql>use database_name
然后使用下面这个命令
mysql>source d:\datafilename.sql
当然你需要将文件所在的路径搞清楚,并且正确地使用了他
进入mysql 安装所在的目录的子目录bin. 输入执行导入sql的命令.
例如: 你的mysql 安装在 d:\mysql
步骤如下:
开始 -> 运行 -> 输入CMD
D:
cd mysql\bin
mysql -u root -p123456 test
其中 root 为你的mysql管理员用户名, 123456 为密码 test为数据库名称 d:\a.sql 为备份下来的数据文件所在位置.
如果是Windows的话,从命令提示符下到MYSQL文件目录中的Bin文件夹下,执行命令
mysql -u root -p databasename
其中root是你MYSQL的用户名,databasename是你数据库的名称,而db.sql你是的文件.注意你必须把db.sql放到bin文件夹下才可以.当然文件的位置可以换.
如果是LINUX的话,直接输入
mysql databasename
就可以了,系统默认mysql命令为系统命令

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

For those unfamiliar, Low Power Mode reduces your Mac's energy usage, potentially extending battery life at the expense of performance temporarily, but it's handled well enough that for most users, they won't notice to any particular degradation. This is a very useful mode if you're a Mac laptop user trying to get the most battery life possible from your MacBook Pro or Air. Enable Mac Low Power Mode from the Command Line From the Terminal, type the following command string on any Mac laptop: sudo pmset -a lowpowermode 1 Press Enter as sudo requires and enter the administrator password to authenticate.

Many friends who use win10 system have encountered this problem when playing games or installing the system. The application cannot be started because the parallel configuration of the application is incorrect. For more information, see the application event log, or use the command line sxstrace.exe tool. This may be because the operating system does not have corresponding permissions. Let’s take a look at the specific tutorial below. Tutorial on using the command line sxstrace.exe tool 1. This problem usually occurs when installing programs and games. The prompt is: The application cannot be started because the parallel configuration of the application is incorrect. For more information, see the application event log, or use the command line sxstrace.exe tool. 2. Start →

With the widespread application of the Linux operating system, more and more people are beginning to need to learn and understand the basic commands and shortcuts in the Linux system. In this article, we will introduce some commonly used Linux commands and shortcuts to help beginners understand the Linux system and improve work efficiency. Commonly used commands 1.1ls command The ls command is one of the most commonly used commands in Linux. It is mainly used to list files and subdirectories in the current directory. Commonly used options are: -l: Display file information in long format, including file type

This article details the steps to upgrade Ubuntu 20.04 to 22.04. For users using Ubuntu 20.04, they have missed the new features and advantages brought by version 22.04. In order to get a better experience and security, it is recommended to upgrade to a newer Ubuntu version in time. Ubuntu22.04 is codenamed "Jamie Jellyfish", let's explore how to get the latest LTS version! How to upgrade Ubuntu 20.04 to 22.04 via the command line Mastering the command line will give you an advantage. While it is possible to update Ubuntu via the GUI, our focus will be via the command line. First, let’s check the currently running version of Ubuntu using the following command: $

In Python, parameters can be passed to scripts via the command line. These parameters can be used inside scripts to perform different actions based on different inputs. Detailed explanation of Python command line parameters: 1. Positional parameters: parameters passed to the script in order on the command line. They can be accessed through position inside the script; 2. Command line options: parameters starting with - or -, usually Used to specify specific options or flags for the script; 3. Pass parameter values: Pass parameter values through the command line.

How to perform log aggregation and statistics through Linux command line tools? Logging is a very important task when managing and maintaining Linux systems. Through logs, you can view system operation, troubleshoot problems, and conduct performance analysis. For large-scale systems, the number of logs is often very large. How to efficiently aggregate and count logs has become a challenge faced by operation and maintenance personnel. In Linux systems, we can use command line tools for log aggregation and statistics. The following will introduce several commonly used command lines

Start the journey of Django project: start from the command line and create your first Django project. Django is a powerful and flexible web application framework. It is based on Python and provides many tools and functions needed to develop web applications. This article will lead you to create your first Django project starting from the command line. Before starting, make sure you have Python and Django installed. Step 1: Create the project directory First, open the command line window and create a new directory

Summary of how to use MySQL and C++ to develop a command-line-based library management system: In this article, we will introduce how to use MySQL and C++ to develop a simple command-line-based library management system. We will cover the entire process from database design to C++ code implementation, and provide specific code examples. Introduction: A library management system is a common application used to manage a library or personal book collection. By using MySQL as the database and C++ as the programming language, we can easily implement
