mysql--Basic Installation and use

Source: Internet
Author: User

Basic Installation

    • : https://dev.mysql.com/downloads/mysql/
    • Select Unzip version: Mysql-5.7.21-winx64.zip
    • Open cmd as an administrator (except that the installation service does not open as this) switch to the bin directory under the extracted directory
    • Initialize the data required files and get a temporary access password: mysqld‐‐initialize‐‐user=mysql‐‐console; a temporary password will appear, copy and paste it will be used later, there will be a data folder in the Extract directory
    • Install MySQL as a service you can specify the service name: Mysqld‐‐install MySQL, the service installed successfully, in the computer services panel to see
    • Start the service: net start MySQL, development can be set to manual start, automatically start the computer will be open every time you restart
    • Through the user name password into the MySQL operating environment: Mysql‐u Root‐p, will prompt enter password, the password just saved in, then entered, MySQL operating environment
    • To set the database access password, be sure to add a semicolon:mysql> set password for [email protected] = password (' 123456 ');
    • Verify: Exit, quit the MySQL environment, and then login: Mysql‐u root‐p, enter the password you just set, if successful, execute: show databases; you'll see the database.

Basic use

Command-line Operations
    • Open cmd, switch to Bin directory
    • Enter MySQL operating environment: Mysql‐u Root‐p, will prompt you to enter the password
    • After entering the MySQL client's REPL environment, you can manipulate the database through standard SQL statements
    • mysql> show databases; ‐‐ Show All databases
    • Mysql> CREATE DATABASE <db‐name>; ‐‐ creating a database with the specified name
    • Mysql> Use <db‐name>; ‐‐ uses a database that is equivalent to entering a specified database
    • Mysql> Show tables; ‐‐ shows which tables are in the current database
    • Mysql> CREATE TABLE <table‐name> (ID int, name varchar (), age int); ‐‐ Create a data table with the specified name and add 3 columns
    • Mysql> desc <table‐name>; ‐‐ View the specified table structure
    • Mysql> source./path/to/sql‐file.sql‐‐ Execute SQL statement in local SQL file
    • mysql> drop table <table‐name>; ‐‐ Delete a data table with the specified name
    • Mysql> DROP Database <db‐name>; ‐‐ Delete a database with the specified name
    • Mysql> Exit|quit; ‐‐ Exit Database End

Visualization Tools

    • Navicat Premium: A cost-free visualizer: http://www.navicat.com.cn/download/navicat-premium, installation is the next step, but the installation must have Microsoft Visual C + + Runtime
    • Enter the interface click Connect, Reproach MySQL, and then basic setup of MySQL database

    • The difference between char and varchar: char is fixed length, varchar is its own length can be constantly adjusted, using the time to pay attention to the character set problem, the default is Latin, can only input English numbers, need to input Chinese need to change to UTF8, can be changed in the table design, You can also make a setting when creating a new database, and you can configure the database server globally

    • Set the server global configuration: Create a new My.ini file in the MySQL directory, enter content such as, remember to restart the database service after configuration changes, the configuration can refer to the official website https://dev.mysql.com/doc/refman/5.5/en /mysqld-option-tables.html, and http://www.cnblogs.com/Ray-xujianguo/p/3322455.html

mysql--Basic Installation and use

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.