Mysql5.1 green version installation tutorial and mysql-related commands (Resolving mysqld-nt failure)

Source: Internet
Author: User

Mysql5.1 green version installation tutorial and mysql-related commands (solve mysqld-nt is not successful) prepare this file, and most of the tutorials are still using the mysql-nt command. The following describes how to install mysql5.1 decompressed version. http://dev.mysql.com/downloads/mirror.php?id=414168 The ingress link is mysql-noinstall-5.1.71-win32.zip. For registration, click No thanks, just startmy download. download, decompress it on your D disk, rename the folder mysql5.1, and path to D: \ mysql5.1; 1. set system environment variables, add D: \ mysql5.1 \ bin in Path; 2. Select the configuration file according to your needs, I only need a small database here, so select the my-small.ini configuration file; modify D: \ mysql5.1 \ my-small.ini file content as follows, save as my. ini is in the same path. [Client] # password = your_password port = 3306 socket = MySQL default-character-set = utf8 # Here follows entries for some specificprograms # The MySQL server [mysqld] port = 3306 socket = MySQL character-set-server = utf8 skip-external-locking key_buffer_size = 16 K Bytes = 1 M table_open_cache = 4 sort_buffer_size = 64 K read_buffer_size = 256 K Bytes = 256 K net_buffer_length = 2 K Thread_stack = 128 K basedir = D: \ mysql5.1 datadir = D: \ mysql5.1 \ data 3, run cmd as an administrator. Go to disk D and run the following command: D: \ mysql5.1 \ bin \ mysqld-install mysql -- defaults-file = "D: \ mysql5.1 \ my. ini "appears Servicesuccessfully installed. indicates that the installation is successful. Then open the service window (enter services in the running box. msc to open the service window, and then you can find the mysql service.) 4. start MySQL Service net start mysqlMySQL service is starting 5. log on to the MySQL server mysql-u root-pEnterpassword :( you can set the root password by yourself. Note: The MySQL administrator username is root and the password is blank by default .) The following is a commonly used mysql command: 1: Use the SHOW statement to find out the current DATABASE on the server: mysql> show databases; 2: 2. CREATE a database mysqldata mysql> create database mysqldata; 3: select the mysql> use mysqldata Database you created. (If you press the Enter key to change the Database, the operation is successful !) 4: Check what TABLES exist in the current database mysql> show tables; 5: CREATE a database TABLE mysql> create table mytable (nameVARCHAR (20), sex CHAR (1 )); 6: display the table structure: mysql> describe mytable; 7: add the record mysql> insert into MYTABLE values ("shiyuan", "w") to the table; 8: load data into a database TABLE in text mode (for example, D:/mysql.txt) mysql> load data local infile "D:/mysql.txt" into table mytable; 9: import. SQL file commands (such as D:/mysql. SQL) mysql> use database; mysql> source d:/mysql. SQL; 10: delete a TABLE mysql> drop TABLE MYTABLE; 11: empty table mysql> delete from MYTABLE; 12: update table data mysql> update MYTABLE set sex = "m" wherename = 'shiyuan '; the following is a management experience of using MySql on the network. MySql exists as a service in windows. Before using MySql, make sure that the service has been started, the net start mysql command is not enabled. In Linux, the "/etc/rc. d/init. d/mysqldstart" command is available. Note that the initiator must have administrator privileges. The newly installed MySql contains a root account with a blank password and an anonymous account, which poses a major security risk. For some important applications, we should improve the security as much as possible, here, you should delete anonymous accounts and Set passwords for root accounts. use the following command: use mysql; delete from User where User = ""; update User setPassword = PASSWORD ('newpassword ') where User = 'root'; if you want to restrict the logon terminal used by the User, you can update the Host field of the corresponding User in the User table. After making the above changes, restart the database service, the following commands can be used for Logon: mysql-u root-p; mysql-u root-p newpassword; mysql mydb-u root-p newpassword; the preceding command parameters are common parameters. For more information, see the document. Here, mydb is the name of the database you want to log on. In development and practical applications, users should not only use root users to connect to the database. Although it is convenient to use root users for testing, it will bring significant security risks to the system, it is not conducive to the improvement of management techniques. We grant the most appropriate database permissions to the users used in an application. For example, a user who only inserts data should not be granted the permission to delete data. MySql User management is implemented through the User table. There are two common methods to add new users. One is to insert the corresponding data rows in the User table and set the corresponding permissions; the second is to use the GRANT command to create a user with certain permissions. The common usage of GRANT is as follows: grant all on mydb. * to NewUserName @ HostNameidentified by "password"; grant usage on *. * to NewUserName @ HostNameidentified by "password"; grant select, insert, update on mydb. * toNewUserName @ HostName identified by "password"; grant update, delete on mydb. testTable toNewUserName @ HostName identified by "password"; to GRANT this user the ability to manage permissions on the corresponding object, you can add the with grantoption option after GRANT. For users inserted into the User table, use the Password function to update and encrypt the PASSWORD field to prevent unauthorized users from stealing the Password. Users who do not need permissions should be cleared, and those who pass the permissions should be revoked in a timely manner. To REVOKE permissions, you can update the corresponding fields in the User table or use the REVOKE operation. The following is my interpretation of common permissions from other information (www.cn-java.com): Global Management permissions: FILE: read and write files on the MySQL server. PROCESS: displays or kills service threads of other users. RELOAD: RELOAD Access Control tables and refresh logs. SHUTDOWN: Shut down the MySQL service. Database/data table/data column permissions: ALTER: Modify existing data tables (such as adding/deleting columns) and indexes. CREATE: CREATE a new database or data table. DELETE: DELETE table records. DROP: delete a data table or database. INDEX: Create or delete an INDEX. INSERT: Add Table records. SELECT: displays/searches for table records. UPDATE: Modify existing records in the table. Special permissions: ALL: allow to do anything (same as root ). USAGE: Only Logon Allowed-nothing else is allowed.

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.