Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The most commonly used ways to use mysql

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "the most commonly used use of mysql", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "the most common use of mysql" bar!

1. To use mysql under shell, follow the method below.

$mysql-u

-p

Password:

Mysql > show databases; / / shows which databases are available

Mysql > create DATABASE lll; / / create a database named lll

Mysql > use lll; / / use a database named lll

Mysql > show tables; / / shows which tables are in the current database

Mysql > CREATE TABLE user (username TEXT not null, userpassword TEXT not null) / / create a table

Mysql > ALTER TABLE user ADD email TEXT not null; / / add a field to the current table

Mysql > ALTER TABLE test DROP come; / / discard a field from the current table

Mysql > ALTER TABLE test CHANGE pass pass LONGTEXT not null; / / change a field in the current table

Mysql > DROP TABLE user; / / discard a table in the current database.

2. Php3 code to realize the creation of database.

$dbc=mysql_connect ("localhost", "youruser", "yourpassword")

Mysql_create_db (zzz); / / create a database called zzz

Echo "success"

? >

3. Create a table using php3:

Dbc=mysql_connect ("localhost", "root", "")

Mysql_select_db ("zzz", $dbc)

Mysql_query ("CREATE TABLE user (username TEXT not null, userpassword TEXT not null)"); at this point, I believe you have a deeper understanding of "the most commonly used use of mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report