Create a MySQL table

Source: Internet
Author: User
Today, when I create a table in MySQL, I first create it in MySQL query browser, but I always report an error. Later I thought it was just a client software that is easy to operate. I guess it won't work. Later, I created a table under the MySQL administrator on the server, but the same error still occurred. No way to go online for help. It turns out that tables are created under the doscommand line in MySQL. After entering the command line, first enter: Net start MySQL (stop server with: net stop MySQL) after the server is started, then enter: mysql-uroot-P here the root represents the user name. Press enter and you will be prompted to enter the password: Enter Password: Password is the password set during installation. (This step may prompt that MySQL is not an internal command because the environment variable is not set. You should add the bin directory under the MySQL installation directory to the path, for example, I am D:/program files/MySQL/bin. When mysql> is displayed, you can create a table. For example, to create a guestbook table in test, follow these steps: mysql> use test database changed mysql> Create Table guestbook-> (-> serial_no int auto_increment not null primary key, -> name varchar (10) Not null,-> guest_time varchar (10) Not null->); the table is created successfully, however, during the input process, note that there must be a space before not null, and there must be a comma (,), and no comma (;) after the last line, these are the basic knowledge of the database, but I forgot to create them several times.
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.