Mysql installation-free configuration _ MySQL

Source: Internet
Author: User
The actual configuration method of the mysql installation-free version: bitsCN.com the following articles mainly tell you about the actual configuration method of the MySQL installation-free version. the installation-free version can be downloaded from the relevant website, after the download can decompress it to c:/MySQL to get his arbitrary location, decompress it in the directory, find the my-huge.ini, my-large.ini, my-medium.ini configuration file.

Open for configuration:


[MySQLd]
# Set basedir to your installation path
Basedir = c:/MySQL
# Set datadir to the location of your data directory
Datadir = c:/mydata/data

In the MySQL installation-free configuration method, we need to set the MySQL character set, gbk or UTF-8.


# Set character set
Default-character-set = gbk
# Set character collation
Default-collation = gbk_chinese_ci

Save and save it as my. ini

Finally, choose start> run.


C:/MySQL/bin/> MySQLd -- install MySQL -- defaults-file = C:/my. ini
C:/MySQL/bin/> net start MySQL

OK. the default account is root and the password is empty.


The above content is an introduction to the configuration method of the free installation version of MySQL. I hope you will have some gains.

The following is a reference of other netizens:
Using mysql-noinstall-5.1.6 (win32) as an example

1> extract the compressed file mysql-noinstall-5.1.6-alpha-win32.zip to a directory, set MYSQL_HOME in the environment variable, and add % MYSQL_HOME %/bin

To path.

2> create the my. ini configuration file. the content is as follows:

[Mysqld]
# Set basedir to the mysql installation path
Basedir =.../mysql
Datadir =.../mysql/data

Put the my. ini file under the system file
The XP system is in the C:/windows directory, and the 2000 system is in the C:/winnt directory.

3> start and stop mysql

Mysqld-nt.exe --install(install Windows service, uninstall using mysqld-nt.exe -- remove)
Start: net start mysql
Stop: net stop mysql

4> connect to mysql
Format: mysql-h host address-u user name-p user password
Example 1: Connect to mysql on the local machine
Mysql-uroot-p
Example 2: Connect to mysql on the remote host
Mysql-h110.110.110.110-uroot-pabcd123

5> exit mysql command
Exit (press enter)
Or
Quit (press enter)

6> Change password
Format: mysqladmin-u username-p old password new password
For example, add a password ab12 to the root user. First, enter the directory mysqlbin in DOS, and then type the following command
Mysqladmin-uroot password ab12
Note: Because the root account does not have a password at the beginning, the old-p password can be omitted.
2. Example 2: change the root password to djg345.
Mysqladmin-uroot-pab12 password djg345

The following is a command in the mysql environment, with a semicolon as the command Terminator

7> add new users
Format: grant select on database. * to username @ login host identified by "password ";

Example 1: add a user named "test1" with the password "abc" so that the user can log on to any host and
Query, insert, modify, and delete permissions. First, use the root user to connect to mysql, and then type the following command:
Grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc ";

Example 2: Add a user named "test2" with the password "abc" so that the user can only log on to localhost and access the database
Mydb query, insert, modify, and delete operations (localhost refers to the local host, that is, mysql data
The host where the database is located.
Access the database only through the web page on the mysql host.
Grant select, insert, update, delete on mydb. * to test2 @ localhost identified by "abc ";

8> Display the database list
Show databases;

9> Display Data tables in the database
Use mysql; // database name
Show tables;

10> display the data table structure
Describe table name;

11> database creation
Create database name;

12> create a table
Use database name;
Create table name (field setting list );

13> delete databases and tables
Drop database name;
Drop table name;

14> clear records in the table
Delete from table name;

15> Display records in the table
Select * from table name;

Example:
Drop database if exists school; // delete if SCHOOL exists
Create database school; // create a database SCHOOL
Use school; // open the SCHOOL library
Create table teacher // create table TEACHER
(
Id int (3) auto_increment not null primary key,
Name char (10) not null,
Address varchar (50) default 'shenzhen ',
Year date
); // Table creation ends
// Insert fields as follows
Insert into teacher values ('', 'glengang ', 'Shenzhen Zhongyi', '2017-10-10 ');
Insert into teacher values ('', 'Jack', 'Shenzhen Zhongyi ', '2017-12-23 ');

Note: Table creation
(1) set the ID to a numeric field with a length of 3: int (3), and automatically add auto_increment to each record,
Cannot be blank: not null, and make it the primary key.
(2) set NAME to a 10-character Field
(3) set ADDRESS to a 50-character field, and the default value is Shenzhen. What is the difference between varchar and char?
It will only be said later.
(4) set YEAR as the date field.
If you type the preceding command at the mysql prompt, debugging is not convenient. You can run the preceding command
It is written as is to a text file, assuming it is school. SQL, then copied to c:, and enter the Directory in DOS status
Mysql in, and then type the following command:
Mysql-uroot-p password <c: school. SQL
If it succeeds, no display is displayed for a blank row. if there is an error, a prompt is displayed. (The above command has been debugged, you
You only need to remove the // annotation ).

16> transfer text data to the database
1. text data should conform to the format: field data is separated by the tab key, and null value is used instead. Example:
3 rose:
4 mike: Shenzhen No. 1,-12-23
2. data import command load data local infile "file name" into table name;
Note: You 'd better copy the file to the mysql in directory and use the use command first? Bytes

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.