In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the method of attaching a database in mysql. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The method of attaching a database in mysql: 1, open [Desktop-my computer-Properties-Environment variables], create a new path [PATH= ";, path\ mysql\ bin;"]; 2, export the database file from the database, the code is [c:\ > mysqldump-h localhost..].
The method of attaching a database to mysql:
1. Setting the command line mode of MYSQL:
Desktop-> my computer-> Properties-> Environment variables-> New->
PATH= ";, path\ mysql\ bin;", where path is the installation path of MYSQL.
Second, briefly introduce how to enter MYSQL on the command line:
1. C: > mysql-h hostname-u username-p
Press enter, wait and enter the password. Where hostname is the name of the server, such as localhost,username is the user name of MYSQL, such as root.
After entering the command line, you can directly manipulate MYSQL.
2. Briefly introduce the MYSQL command:
Mysql- > CREATE DATABASE dbname;// create database mysql- > CREATE TABLE tablename;// create table mysql- > SHOW DATABASES;// displays database information, and those databases are available. Mysql- > USE dbname;// Select database mysql- > SHOW TABLES;// displays table information, and there are available tables MySQL-> DESCRIBE tablename;// displays the information of the created table
Third, export database files from the database:
1. Export the database mydb to the e:\ mysql\ mydb.sql file:
Open start-> run-> enter cmd to enter command line mode
C:\ > mysqldump-h localhost-u root-p mydb > e:\ mysql\ mydb.sql
Then enter the password and wait for a while for the export to be successful. You can check whether it is successful in the target file.
2. Export the mytable in the database mydb to e:\ mysql\ mytable.sql file:
C:\ > mysqldump-h localhost-u root-p mydb mytable > e:\ mysql\ mytable.sql
3. Export the structure of the database mydb to the e:\ mysql\ mydb_stru.sql file:
C:\ > mysqldump-h localhost-u root-p mydb-- add-drop-table > e:\ mysql\ mydb_stru.sql
Fourth, import data from an external file into the database:
Import the SQL statement from the file into the database from e:\ mysql\ mydb2.sql:
1. Enter mysql from the command line, and then create the database mydb2 with the command CREATE DATABASE mydb2;.
2. You can enter the command exit; or quit to exit mysql
3. Enter the following command in CMD:
C:\ > mysql-h localhost-u root-p mydb2 < e:\ mysql\ mydb2.sql
Then enter the password and OK it.
5. Let's talk about the solution to the problem of the size limit of the imported file:
By default: mysql has a limit on the size of the imported file, with a maximum of 2m, so when the file is very large, it cannot be imported directly. The solution to this problem is listed below:
1. Modify the relevant parameters in php.ini:
There are three parameters that affect the size of the mysql import file:
Memory_limit=128M
Upload_max_filesize=2M
Post_max_size=8M
Modify upload_max_filesize=200 M here to modify the size that meets your needs
You can modify the other two memory_limit=250M,post_max_size=200M at the same time
This allows you to import .sql files below 200m.
On the method of attaching database in mysql to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.