Mysql Command Line

November 7th, 2009 | No Comments | Posted in Article

MySQL is a powerful database open-source, meaning that they are free to use. One of the many tools that come with MySQL, MySQL their command line, you just about everything to create a database to add and edit entries in the database. This article will help you get started with MySQL command line successfully. During the installation of MySQL, a program command line that you create new databases, modify the current database is maintained, and delete databases. Once you start the MySQL client command line will be provided for a password, do you use when you are prompted to MySQL. Hence, a prompt to mysql>, you can enter your commands. Let's start by creating a database in our system: mysql> CREATE DATABASE temp Query OK, 1 row affected (0. 00 sec) Verify that the development of databases, tables and fields for the names of wholesale sensitive and can not contain spaces. All commands from the command line (must end with a semicolon;) or they will promtped For more commands. For this new data, we created, we need to change it again and that's where the USE command comes into play. > USE mysql temp; changedNow database that we have a database operation, it creates a table in the basis of our relativesmysql Stores> CREATE TABLE family (name char (25), age, integrity, brook relationship (50)); Query OK, 0 rows affected (0. 05 sec) We have created a table that contains three columns, then let go a little more detail on this command we just ran. First, we have the CREATE TABLE, which does exactly what it does and it creates the table said. When we entered the family name of the table we just created. Everything else in the parenthasis are fields of the table and what kind of information will be stored in this field. For example, name char (25) tells SQL to say to a field in the table with the name "name" and char (25), he describes a character field, you can be any character you want in this type and it is 25 characters long. The entire SQL age announced in a field in the table called "Old age and there is an integer that integers are stored in this field. You can add the size of the entire field as the use of signs, but it is not necessary because the standard length of a field is 11 Intergen The latter is exactly like the first Realtions char (50) to the except that we can from this area up to 50 characters instead of 25 inmates. Now that we have created a database and a table can seem a Coupld show commands to see what we have. The controls have demonstrated that they are roughly based on what they do. Let's start with the SHOW DATABASES; mysql> SHOW DATABASES ;+—————-+| database |+————– – + | temp | | mysql | | mikenetpc |+—————+ 3 rows in set (0. 01 sec) You can see that the SHOW DATABASES you They will print a list of all databases on the system, so you can guess what the SHOW TABLES once you've used the USE command-temp. Yes, you guessed it, it will also view a list of all tables in the database temp. SHOW TABLES mysql> ;+———————-+| temporary tables in |+————- – Family ——-+| in |+———————-+ 1 set line (0. 01 sec) can continue later in the Show commands and can watch the table for you and see all the areas that we have. We are just SHOW COLUMNS FROM Family Code. mysql> SHOW COLUMNS FROM> Family ;+———-+————-+——-+——– + ————+———+| Field | Type | Null | Key | Default | Extra |+———-+- – ———–+——-+——–+————+——- – - + | name | char (25) | YES | | NULL | | | age | int (11) | YES | | NULL | | | Relations | char (50) | YES | | NULL | |+—- – —–+————-+——-+——–+———–+ – ———+ now have 3 rows in set (0. 07 sec), we confirmed a database and a table that exists and the configuration as we wish, Are you some information table as a database is not good, without any information. If you look at all makes the PHP programming and MySQL for the next 2 commands is very familiar. Here, you can start by going to a few people at the table with the INSERT INTO table. We'll add Derek, who is 22 and my cousin, Chelsie, 21 and my cousin, and Leslie, who is 27 and my sister. INSERT INTO family (name, age, link) VALUES ( 'Derek', 22 'cousin values'>'); Query OK, 1 row affected (0. 03 sec) mysql> INSERT INTO family (name, age, relationship) (cousin Chelsie ', 21' '); Query OK, 1 row affected (0. 03 sec) mysql> INSERT INTO family (name, age, link) VALUES (' Leslie ', 27' Sister ') Query OK, 1 row affected (0. 03 sec) Now that we have our information have a look and confirm everything is there. We'll use the SELECT command to display the content in the table. mysql> SELECT * FROM ;+———–+——+————-+| Name | Age | links | + – - ———-+——+————-+| Derek | 22 | Cousin | | Chelsie | 21 | Cousin | | Leslie | 27 | Sister |+———-+——-+————-+ 3 rows in set (0. 01 sec) We can also use the SELECT command for the list or select only a certain person. mysql> SELECT * FROM ORDER BY name ;+———–+——+————-+| Family Name | Age Relations | Chelsie |+———–+——+————-+| | 21 | Cousin | | Derek | 22 | Cousin | | Leslie | 27 | Sister |+———+——+—————+ 3 rows in set (0. 01 sec) As you can see simply by adding ORDER BY name that we have the information in the table by city name. Now go to a specific person of tablemysql> SELECT * FROM family WHERE name = 'Leslie';+———+——+———– – + | Name | Age | Linked |+———+——+————-+| Leslie | 27 | Twin Cities | + – ——–+——+————-+ 1 rows in set (0. 01 sec) with the skills we want the same name be on some records, we can remove from the table.

Mike Walton, in the technology field for over 8 years and 6 + years in the hospitality Technolgy. Mike has experience with Microsoft Windows Server 2000, 2003, Windows 98, XP and Vista, networking, Cisco networking equipment, PCI DSS, and much more. Mike Walton is also the founder of items MikeNet Free PC and video. http://www. mikenetpc. com
Related Posts with Thumbnails



Tags: , ,

Or for further references, check out the following resources:



Related Article:


Leave a Reply