Install and configure the application in mysql5 decompressed windows

Source: Internet
Author: User
Tags mysql functions win32 window
Note: This article summarizes the mysql-noinstall version, that is, the installation and configuration application of the decompressed version. These operations are commonly used. The article does not describe the executable installation version of MySQL. the executable installation version has many drawbacks. In short, I like green products, including eclipse, tomcat, JBoss, and Apache. Even if the operating system is reinstalled, these software does not need to be reinstalled! Environment:
Windows 2000/XP/2003
Mysql-noinstall-5.0.45-win32.zip 1. Download MySQL
Http://dev.mysql.com/downloads/ Ii. Installation Process 1 unzip mysql-noinstall-5.0.45-win32.zip to a directory, add to decompress to D: \ mysql-5.0.45-win32 directory. 2, write MySQL running configuration file my. ini, placed in the D: \ mysql-5.0.45-win32 directory
My. ini
-----------------------------
[Winmysqladmin]
# Specify the MySQL Service Startup File
Server = D: \ mysql-5.0.45-win32 \ bin \ mysqld-nt.exe
 
[Mysqld]
# Set the installation directory of MySQL
Basedir = D: \ mysql-5.0.45-win32
# Set the data storage directory of the MySQL database, which must be data or \ XXX \ data
Datadir = D: \ mysql-5.0.45-win32 \ data
# Set the character set of the MySQL server
Default-character-set = GBK
# Set the server port
Port = 3306

[Client]
# Set the character set of the mysql client
Default-character-set = GBK
--------------------------- 3. Install the MySQL Service
Enter Directory D: \ MS-DOS \ bin from the mysql-5.0.45-win32 window and run the following command:
Mysqld -- install mysql5 -- defaults-file = "D: \ mysql-5.0.45-win32 \ My. ini" if you just use it once, you can run it directly in the bin directory:
Mysqld -- Console
You can.
4. Start the MySQL database
In the above command window, enter the command: Net start mysql5
In this way, the MySQL service is started.
(If the startup fails, check whether the directory of the INI file is correct.) 5. log on to the MySQL database locally.
In the preceding command window, run mysql-u root-P.
Enter the password.
The password for the first installation of the MySQL decompress version administrator root is blank, so you can directly press enter to log on to the MySQL database. If you are not logging on to MySQL for the first time and you still have a network address, you can use the following command to log on to the MySQL server, which may be far away or local. This logon method is called "remote Logon". The command is as follows: mysql-H 192.168.3.143-u root-P
Mysql-H 192.168.3.143-u root-pleizhimin-h indicates the logon IP address,-u indicates the user, and-P indicates the password. If no password is written after-P, next, you will be prompted to enter the password. After-P, you can also write the password directly, so that you no longer need to enter the password. 6. operate databases and tables
After logging on to the MySQL database, you can run the command: Use Database Name
After specifying the database object for operation, you can operate the tables in the database. The operation method is of course an SQL command. 7. change the password of the MySQL database administrator root.
MySQL database has a MySQL database by default, which is a MySQL System database used to save a lot of information such as database users and permissions. To change the password, you must operate the MySQL database user table. The password of the root user in MySQL is still empty, which is very insecure. Assume that you want to change the password to "leizhimin ". In the preceding command window, run the following command:
Use MySQL;
Grant all on *. * to root @ '%' identified by 'leizhimin' with grant option;
Commit; this command means to add a root user with all permissions. The password is "leizhimin", and this user can be accessed locally or through the network. It is emphasized that this is because the root user of the MySQL system can only access the database locally. Its @ character is followed by localhost. For details, you can view the uer table of Mysql Data. In this way, there are two root users, one is the original system, and the other is newly created, for the convenience of management, delete the MySQL Root User and keep the created root user because the user can access MySQL through the network. Then, delete the user's command:
User MySQL;
Delete from user where user = 'root' and host = 'localhost'; commit; in fact, the above method is the authorization command, which creates a database user while authorizing. MySQL also has a separate way to change the user password. Let's take a look at how to perform this operation. First, create a user lavasoft with the password 123456 grant all on *. * To lavasoft @ 'localhost' identified by '000000' with grant option; next, change the password of this user to leizhiminupdate user SET Password = PASSWORD ('leizhimin ') where user = 'lavasosft 'and host = 'localhost ';
Flush privileges; note that it is best to create a MySQL user using Grant. Especially for MySQL DBAs, it is important to specify user permissions when creating a user. This modification method is actually implemented using MySQL functions. I will not introduce it one by one. Note that MySQL does not allow you to specify an alias for a table during password modification or other operations, but does not have this restriction for the first time. 8. Create a database
In fact, in addition to the MySQL database, the MySQL database also has an empty database test for testing. Create a database testdb and execute a series of SQL statements to view the basic operations of the MySQL database. Create Database testdb: Create Database testdb; create database if not testdb: Use testdb;
Create Table Table1 (
Username varchar (12 ),
Password varchar (20); Preventive creation of table AAA: Create Table if not exists AAA (SS varchar (20); view table structure: Describe Table1; insert data to 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 = 'hei' 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 'gender ',
Age date not null comment 'age'
);
Commit; create a table from the query Table1: Create Table TMP asselect * From Table1; Delete table 1: Drop table if exists Table1; drop table if exists TMP; 9. Back up the database testdbmysqldump-H 192.168.3.143-u root-pleizhimin-X -- default-character-set = GBK> C: \ testdb. SQL 10. Delete the database testdbdrop database testdb. 11. Restore the database testdb. First, create the database testdb and run the following command to recover the database locally: mysql-u root-pleizhimin testdb <C: \ testdb. SQL 12. Delete the MySQL Service
If you are tired of MySQL and need to uninstall it, you only need to stop the MySQL service.
Net stop mysql5 Delete MySQL Service
Enter Directory D: \ MS-DOS \ bin from the mysql-5.0.45-win32 window
Mysqld -- remove mysql5
The following name must be the same as that at installation.

Delete the msyql installation folder without any trace.

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.