Home php教程 php手册 如何将Access和Excel导入到Mysql中之二

如何将Access和Excel导入到Mysql中之二

Jun 13, 2016 am 10:05 AM
access excel mysql one and how Install import Will database of

一。Mysql数据库的安装、建库和ODBC的安装设置
  Mysql和ODBC驱动可以在其主页(http://www.mysql.com/)下载,在右边的Latest Versions点击进去,下载相应的版本就行了。这里我们要下载Intel版本的Mysql(最新版本为3.23.40),ODBC驱动则是MyODBC 2.50.37 for NT/2000 (full setup),如果使用Win95/98,其驱动是不同的,请注意区分。
  然后就可以安装了,Mysql的安装是非常简单的,将它解压到一个目录(C:mysql),在Win2000中,Mysql可以作为Windows的一个服务运行,在命令行中运行"C:mysqlinmysqld-nt --install",然后在Win2000管理工具的服务中我们就可以发现有Mysql这个服务运行,不过我发现直接运行winmysqladmin.exe也是可以的,这时会要求输入一个密码,这是Mysql的连接密码,请记好,默认的连接是没有密码的(用户为root)。
  其后是建立数据库和表,由于要将Access和Excel中的数据都导过来,因此表格中要包括两者的全部字段,这里为简单起见,只选择了其中的一些字段来说明,运行cmd进入到命令行方式,切换到c:mysqlin目录,执行"mysqladmin create build",这个命令是创建数据库,build是数据库的名称,成功后,执行“mysql”,进入"Mysql>"的命令行方式下,执行以下的命令:
mysql>use build;
mysql>CREATE TABLE loupan (
id int(10) unsigned NOT NULL auto_increment,
loupantype varchar(6),
inputdate date,
at_whatsection varchar(6),
buildname varchar(50),
buildaddress varchar(50),
room tinyint(4),
hall tinyint(4),
areasize decimal(10,2),
exp_sellprice decimal(13,2),
ownername varchar(20),
contactway varchar(50),
memo varchar(255),
updatestatus char(1),
goodloupan char(1),
PRIMARY KEY (id)
);
  接着就会出现Query OK, 0 rows affected (0.04 sec)的成功提示,上文中use build表示切换当前的数据库为build,接着的语句是建表的命令,字段由上至下表示的是id号(自动加1,而且是该表的主键)、楼盘的类型、输入的日期、所在的区域、楼盘的名字、地址、房间的数目、厅的数目、面积、期望售价、业主的名字、联系方式、备注、更新状态、笋盘标志。
  接着就是安装Mysql的ODBC驱动了,MyODBC的安装也是傻瓜式的,运行setup,一步步确认。结束后,就可以在控制面板的ODBC数据源中进行设置了,点“系统DSN”,选择“添加”,在驱动程序的列表中选择“mysql”,就会弹出一个配置页面,在Windows DSN Name中输入数据源的名称,这里输入build(还可以输入其它的名称,不一定跟数据库的名字相同),在“MySQL host(name or IP)”中,输入“localhost”,表示Mysql运行在本机上,在Mysql Database Name中输入数据库的名字“build”,User中输入“root”,PassWord中输入刚才设置的密码,如果刚才没有设置的话,留空,按“OK”后,就会在系统数据源中多了一项“build”,这样Mysql的ODBC数据源就设置成功了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

How to install mysql in centos7 How to install mysql in centos7 Apr 14, 2025 pm 08:30 PM

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

See all articles