Mysql database version control dbv, mysql database version dbv

Source: Internet
Author: User
Tags mysql command line

Mysql database version control dbv, mysql database version dbv

Version Control software includes svn git and so on. These tools control the source code version very well, but what about database version control? The traditional method is to export the entire database, so the efficiency of team collaboration is very low. Is there a tool that can easily synchronize the database structure? Yes, there are also many. I use dbv to integrate it into PHP + MYSQL projects, which is very convenient.

Dbv1.1 download https://github.com/victorstanciu/dbv/archive/1.1.zip

Usage:

1. after downloading the package, decompress it to the project directory under the software control of git or SVN version. For example, if my project directory is 93zp_project, after unzipping, dbv is in 93zp_project/dbv-master, set dbv-master/data to writable.

2. Change config. conf. sample to config. conf and change it to the following red place:

Define ('db _ host', 'localhost ');
Define ('db _ port', 3306 );
Define ('db _ username', 'root ');
Define ('db _ password', '123 ');
Define ('db _ name', '93zp ');


93zp is the database for version control.


3. Access http: // localhost/93zp_project/dbv-master/index. php and enter the user name dbv and password dbv. You can modify the user name and password in config. conf. The database table of 93zp is displayed. The following page is displayed for each modification record:



Column [In DB] indicates whether the record is In the database, and column [On disk] indicates whether the record is exported to the hard disk. The value of On disk is NO, indicating that NO modification records have been exported.

4. Press the "Export to disk" button to Export the record, so that the modification record can be saved under dbv-master/data/schema.


After the team members update the project, they also access http: // localhost/93zp_project/dbv-master/index. php can see which records need to be imported to the database. Check the corresponding records and click [push to databse] to synchronize the database! After synchronization, the In DB is In the YES state. For example, both the aaa and ssss modification records have been synchronized.



How to open Mysql database

Copy the shows. MYD folder to the data directory of the mysql installation directory.
If you install it by default, you should install it in c: \ Program Files \ MySQL Server 5.0 \ data \

Note that the directory where the shows files are located. Copy the directory together. According to your description, it should be the data directory. Copy the data directory under d: \ data1 \ To c: \ Program Files \ MySQL Server 5.0 \ data.

After that, restart mysql and run services. msc to find mysql and restart mysql. (If you have configured the mysql service during installation, I think you should have configured it)

After restart, enter the command line,
Then mysql-uroot-p enters mysql

Show databases;

See if you can see a database named data.

If you can see it, congratulations, continue with the following command. If not, check method B.
Use data

Alter table shows add column name type length and so on
Example:
Add a column named id for the int type
Alter table shows add id int (11) not null default '0 ';
Alter table shows add name varchar (32) not null default '';

If you want to specify the position of a column, if the column to be added is behind the number column. So
Alter table shows add id int (11) not null default '0' after number;

Method B.
If you do not see the data database after restarting mysql in the file copy method described earlier, it may be caused by inconsistent mysql versions. It should be said that this is highly likely.
Then, you ask your friends to export the database content to you. Use the mysqldump command.

Mysqldump-uroot-p-D database name. Table Name> sss. SQL

You get this sss. SQL and then import it to your mysql database.
Run in cmd
Mysql-uroot-p test <sss. SQL
Or
Run the following command in the mysql command line:
Use test
Source sss. SQL
In this way, the shows table is imported to your test database.
The rest is simple. It is no different from the previous one.
Use test
Alter command

In this way, everything is done.
If you have any questions, Baidu hi or mail zwonder@126.com

Wish you success

Why do many large companies use mysql databases?

First, let's look at your impression: MySQL is also very powerful, but it only has a small number of visual interface operation tools, which makes it hard for beginners to get started.
It has the following advantages: open-source, free, supports non-WINDOWS operating systems (and runs faster than WINDOWS), fast, and secondary development (in addition to specific applications, generally, secondary development is not required ).
Large companies pay more attention to copyrights, and developers cannot use pirated copies at will. Therefore, if all of them use genuine databases, the cost will definitely increase.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.