mysql5.5 Decompression Version Configuration

Source: Internet
Author: User
Tags mysql client

First, download underneath the http://dev.mysql.com/downloads/mysql/. second, the installation process1. Unzip the mysql-noinstall-5.0.37-win32.zip to a directory and add the extract to the E:\myserver directory. 2. Write the MySQL running configuration file My.ini
My.ini
-----------------------------
[Winmysqladmin]
# Specify the files that the MySQL service starts to start
Server=e:\\myserver\\mysql-5.0.37-win32\\bin\\mysqld-nt.exe

[Mysqld]
# set up the MySQL installation directory
Basedir=e:\\myserver\\mysql-5.0.37-win32
# Set the data storage directory of the MySQL database, must be either data, or\\xxx\data
Datadir=e:\\myserver\\mysql-5.0.37-win32\\data
# set up the MySQL server's character set
Default-character-set=gbk

[Client]
# Setting the MySQL client's character set
Default-character-set=gbk
-----------------------------If you don't want to write My.ini, you can also modify the INI file that comes with MySQL directly. Modify the contents of the D:\mysql-5.0.37-win32\my-small.ini file to add red content
[Client]
#password = Your_password
Port = 3306
Socket =/tmp/mysql.sock
DEFAULT-CHARACTER-SET=GBK[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
DEFAULT-CHARACTER-SET=GBK
Skip-locking
Key_buffer = 16K
Max_allowed_packet = 1M
Table_cache = 4
Sort_buffer_size = 64K
Read_buffer_size = 256K
Read_rnd_buffer_size = 256K
Net_buffer_length = 2K
Thread_stack = 64K After the modification is complete, save. 3. Install MySQL Service
To enter directory E:\myserver\mysql-5.0.37-win32\bin from the MS-DOS window, run the following command:
mysqld--install mysql5--defaults-file=e:\myserver\mysql-5.0.37-win32\my.ini4. Start MySQL Database
Also in the command window above, enter the command: net start MYSQL5
This launches the MySQL service. 5. (local) log in to MySQL database
Also in the command window above, enter the command: Mysql-u root-p
Enter the password when prompted.
MySQL decompression version of the initial installation of administrator root password is empty, so directly return to the MySQL database once again log in. If you are not the first to log in to MySQL, you also have the network address of the user, then you can use the following command to log on to the MySQL server, the MySQL server may be in the distance, perhaps on the local. This type of login is called "remote login", the command is as follows: Mysql-h 192.168.3.143-u root-p
Mysql-h 192.168.3.143-u root-pleizhimin-h is the specified login ip,-u specified user,-p to specify the password, after-p if nothing is written, then the next prompt to enter a password,-P can also be directly written on the password, so that no longer need to enter a password. 6. Operation Database and table
After logging in to the MySQL database, you can execute the specified operations database, using the command: Use database name
After specifying the database object of the operation, you can manipulate the table in the database, and the operation method is of course SQL command, hehe. 7. Change the password of MySQL database administrator root
MySQL database in the default has a MySQL database, this is the MySQL system database, used to save database users, permissions and many other information. To change the password, you need to manipulate the user table of the MySQL database. Now the root user password for MySQL is still empty, very insecure, assuming you want to change the password to "Leizhimin". Also in the command window above, execute the following command:
Use MySQL;
Grant All on * * to [email protected]'% 'identified by ' leizhimin ' with GRANT option;
The meaning of this command is to add a root user with all the permissions, the password is "Leizhimin", and the user can access it either locally or over the network. The reason for this is that the root user that comes with the MySQL system can only be accessed locally, and the identity behind the @ character is localhost. Specifically, you can view the MySQL data uer table to see, so since, there are two root users, one is the system original, a new, for the convenience of management, will be MySQL with root delete, keep the root user just created, The reason is that this user can access MySQL over the network. Then, delete the user's command:
Use MySQL
Delete from user where user= ' root ' and host= ' localhost ';
Commit In fact, the above method is to authorize the command, while authorizing the creation of the database user. MySQL also has a separate way to modify the user's password, see below how to operate. First, create a user lavasoft with the password: 123456grant all on *. * To[email protected]' localhost ' identified by ' 123456 ' with GRANT option; Next, modify the password for this user: LeizhiminUpdate user Set password = password (' leizhimin ') where user = ' Lavasoft ' and host= ' localhost ';
Flush privileges;Note that it is best to create a MySQL user in Grant's way, especially for MySQL DBAs, to specify user rights while creating a user, and it is important to develop good habits. This method is actually using the MySQL function to do, there are more methods, I do not introduce each. It's also important to note that MySQL does not allow aliases to be assigned to a table while modifying the password, but there is no such limit for the first time outside.
8. Create a Database
In fact, the MySQL database in addition to the MySQL database, there is an empty database test, for users to test the use. Now continue to create a database TestDB and execute a series of SQL statements to see the basic operation of the MySQL database.To Create a database testdb:CREATE database TestDB;Preventative creation of databases:CREATE DATABASE if not TestDBTo Create a table:Use TestDB;
CREATE TABLE table1 (
Username varchar (12),
Password varchar ());Preventative creation of table AAA:CREATE table if not EXISTS AAA (SS varchar);To view the table structure:describe table1;insert data into table table1:
Insert INTO table1 (Username,password) values
(' Leizhimin ', ' Lavasoft '),
(' Hellokitty ', ' Hahhahah ');commit; Query table table1:
SELECT * FROM table1;Change data:
Update table1 set password= ' hehe ' where username= ' hellokitty ';
commit;Delete data:Delete from table1 where username= ' hellokitty ';
commit;add a column to the table:ALTER TABLE table1 add column (
Sex varchar (2) Comment ' sex ',
Age date is not null comment ' ages '
);
commit;Create a table from a query table1:CREATE TABLE tmp asselect * FROM table1;To Delete a table table1:drop table if exists table1;drop table if exists TMP; 9. Backing Up the database TestDBmysqldump-h 192.168.3.143-u root-pleizhimin-x--default-character-set=gbk >c:\testdb.sql10, delete database testdbdrop databases TestDB; 11, restore the TestDB database first establish the TestDB database, and then use the following command for local recovery:mysql-u root-pleizhimin TestDB <c:\testdb.sql12. Delete MySQL Service
If you're tired of MySQL and you need to uninstall, then you just have to do it.Stop MySQL Service
net stop MySQL5Delete MySQL Service
SC Delete MySQL5
Then delete the MSYQL installation folder without leaving any traces. Oh, now it seems that oninstall (non-installation decompression) version of MySQL good, green environmental protection.
Well, don't say, I believe you have mastered the basic operation of MySQL.read this, MySQL EXE version of what is fun, hey ...

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.