Quick hands-on mysql-graphical operation

Source: Internet
Author: User
Tags character set mysql mysql download mysql query net new features table name mysql database

First, MySQL download and installation

 
 1. Download introduction
 
    MySQL believes everyone must have heard of it. If you don't know what it does, you can google it.
    Home of MySQL: http://www.mysql.com/
    MySQL download address: http://dev.mysql.com/downloads/ Because you have to download a lot of stuff from this address, analyze this page in detail.

   
 
● Regarding mirror sites, there is no mainland, but Hong Kong and Taiwan. I chose it to speed up the download, but it's not absolute. I often download from mirrors in North America, and the speed is faster.
 
● MySQL database server Here I choose MySQL 4.1. The version is too low, and many new features are not available; too high, the test is not perfect, and it is easy to bug. Select it recommended here.
 
   Click this link to enter the download page, you can see that the current version is 4.1.8. Find "Windows downloads", as shown, because I use Windows platform. Here I choose the "Without installer (unzip in C: /)" version, because I like software that does not need to be installed. If I am unhappy, I can delete it at any time. Of course, I need to configure it to use it.
   Click "Pick a mirror" to enter a page where the form can be left blank, just select a link to download it. The file name after downloading is "mysql-4.1.8-win-noinstall.zip" and the size is 35.2M.
 
 
● Regarding the "Graphical clients" graphical interface client, choose one to perform graphical operations. Why not? It's just that I have always used the "MySQL Control Center", but now I don't develop it. Select "MySQL Administrator". The file name after downloading is "mysql-administrator-1.0.19-win-noinstall.zip" (here I choose the version that does not require installation) and the size is 4.5M.
 
   Also select "MySQL Query Browser", which is here to query. The file name after downloading is "mysql-query-browser-1.1.5-win-noinstall.zip" (the version does not need to be installed) and the size is 4.5M.
 
   There are many softwares in this area, such as: MySQL-Front, EMS MySQL Manager, etc., which are easy to use, but they are for Money.
 
● "Application Programming Interfaces (APIs)" Application Programming Interface Since I am mainly oriented to Java applications, I choose "MySQL Connector / J" and select "MySQL Connector / J 3.0" as the version is "Procdution". The file name after downloading is "mysql-connector-java-3.0.16-ga.zip" and the size is 1.2M.
 
 
2.Install MySQL
 
  · Find the downloaded mysql-4.1.8-win-noinstall.zip and unzip it to drive D. It is a "mysql-4.1.8-win" folder. Here I rename it "mysql" because I don't like it. With version number. This is the "D: / mysql" directory. There is a "data" directory under this directory. This is where the data is stored. In order to facilitate backup and upgrade, it is best to place it elsewhere. Here I create a new directory "mysql-data" on the D drive, and then cut the "data" subdirectory under the "D: / mysql" directory into the "D: / mysql-data" directory.
  
  Create a new "my.ini" file, and note that the suffix is "ini". The contents are as follows:
E: /WINDOWS/my.ini
[WinMySQLAdmin]
   Server = D: /mysql/bin/mysqld-nt.exe
  
[mysqld]
   basedir = D: / mysql
   datadir = D: / mysql-data / data
  The above "Server" points to the main MySQL execution program, "basedir" points to the MySQL installation directory, and "datadir" points to the MySQL data storage directory (because I changed it, I need to specify it).
  Then move this file to the Windows system installation directory. Here I am "E: / WINDOWS".
 
  · Open an MS-DOS window and change to the "D: / mysql / bin" directory; or add "D: / mysql / bin" to the "Path" variable in "Environment Variables" to avoid switching to "D: / mysql / bin "directory.
 
  Added to Windows XP services:
       D: / mysql / bin> mysqld-nt -install
   (At this time, open the "Control Panel"-> Administrative Tools-> Services: you can see that there is a "MySQL" service in the service list. If you do not want it to be executed automatically, you can change it to manual, you can save some memory when it is not used)


   · Start and stop the mysql service
       D: / mysql / bin> net start mysql
       D: / mysql / bin> net stop mysql
 

         
   Remove mysql service
         mysqld-nt --remove
   (If you no longer need MySQL, stop the MySQL service first, then move out of the MySQL service, and finally delete the MySQL installation directory)
 
 
 
Second, the basic operation
 
● Preparation
 
  Create a mysql-software directory on drive D, copy the mysql-administrator-1.0.19-win-noinstall.zip you just downloaded into this subdirectory, and decompress it to get a MySQL Administrator 1.0 directory.
  Do the same with mysql-query-browser-1.1.5-win-noinstall.zip to get a directory of MySQL Query Browser 1.1.
  
 
● Start the service:
 
· Double-click MySQLSystemTrayMonitor.exe in the D: / mysql-software / MySQL Administrator 1.0 directory, and an icon will appear on the right side of the taskbar. Click "Start Instance" to run MySQL.

 
· Then double-click MySQLAdministrator.exe in the D: / mysql-software / MySQL Administrator 1.0 directory, or directly click "MySQL Administrator" in the right-click menu above:

 
· Create a connection name, you can fill it in here, here is "mxj", username: root, password is blank. This is because mysql has a root account without a password by default. Click "OK", the management window appears:

There is nothing to say, and English is very simple. Just talk about the two items checked above.
 
● Change password

OK, my root account password is set to: javamxj Finally, click "Apply Change".
 
● Initial database

  As you can see in the figure above, there are initially two databases. The MySQL database contains various configuration information. Do not perform table operations in this library.
The test library is initially empty. In addition, when creating a table, do not use the same name as the table name in the mysql library to avoid conflicts.
 
 
● Data creation and query (also talk about character encoding)
 
· Now come to the query browser, or right-click the "MySQL System Tray Monitor" icon in the lower right corner, and select "MySQL Query Browser", because the root password has been changed, you need to fill in the new password.

 
Enter the main interface, right-click the test database, and create a new table.
 
 
· Simply create a table as follows

 
· Switch to "Table Options":

   If you understand the database, these should be very familiar, not much to say. Note that the default character setting is "Latin1" (save changes, switch to this field again, you can see).
 
· Fill in some test data:

 
 
· Close the "MySQL Query Browser", re-open it, switch to the testtable table, did you see it? The Chinese input just now becomes "??????", why? Switch to "Table Options" again:

 You know why, the default character is "latin1" because MySQL is a product of a Swedish company. The Chinese seem to be working hard!
 
 
● Solution:
 
· Stop the MySql service, close all MySql-related programs, open the my.ini file in the Windows system installation directory, and modify it as follows:
E: /WINDOWS/my.ini
[WinMySQLAdmin]
   Server = D: /mysql/bin/mysqld-nt.exe
  
[mysqld]
   basedir = D: / mysql
   datadir = D: / mysql-data / data
   default-character-set = gbk
  
[client]
   default-character-set = gbk
The meaning of the two added statements is that the client and server use the GBK character set for encoding.
 
After saving, reactivate the MySql service, open "MySQL Query Browser", create a table again, enter Chinese, everything is OK!
 
 
 
 
Postscript
 
   Regarding how to use the command line for MySQL operation on the DOS side, I won't talk about it here. There is a lot of information on the Internet. There is a lot of software for graphical operation of MySQL, but most of them need to be costly. Use it by yourself.
   As for the mysql-connector-java-3.0.16-ga.zip file, it will be used when developing EJBs in the future.
<script language = "JavaScript" src = "/ netbei / x / view_a2.js" type = "text / javascript"> </ script>

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.