MySql基本操作
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了MySql基本操作,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2134字,纯文字阅读大概需要4分钟。
内容图文
![MySql基本操作](/upload/InfoBanner/zyjiaocheng/492/96fd1a90950d459cacf3760610e5d949.jpg)
MySQL:应用场景(互联网企业,扩展性强)
mysql 是一个客户端命令
quit 退出
mysql -u ‘tedu@192.168.0.199‘ -p
\c 退出当前行输入
status; 显示基本信息
//建库
create database ttms_lmg default character set utf8;
//建表
create table t1 if not exists t1(
-> id int primary key,
-> title varchar(50),
-> createtime datetime);
//建表后修改字符集
alter database ttms default character set utf8;
//更改字符集
create database aaa;
set names utf8;
use aaa;
//添加判断,表存在则删除
drop table if exists t1
数据库表数据的CRUD操作
insert select update delete
//使用帮助文档,使用help等价与?
? drop database ?create database ?int ?bigint
? function 查看系统中有那些函数
? now
select now(); 显示当前时间
insert into t1 (createtime)values (now());
set foreign_key_checks=0; 设置不检查外键约束
set names utf8;
source d:/ttms01.sql 引入外部.sql文件(window系统下)
source /home/soft01/test.sql; (linux系统下)
======================================================================
【====Linux系统配置启动MySQL=====】
[soft01@cpe-172-88-7-187 桌面]$ su root;
密码:tarenamiszhengzhou
[root@cpe-172-88-7-187 桌面]# rm -rf /var/lib/mysql/mysql.sock;
[root@cpe-172-88-7-187 桌面]# service mysqld restart;
停止 mysqld: [确定]
正在启动 mysqld: [确定]
[soft01@cpe-172-88-7-187 桌面]$ mysql -uroot;
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.71 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql> Ctrl-C -- exit!
Aborted
[soft01@cpe-172-88-7-187 桌面]$
MySql基本操作
标签:now() == datetime clear distrib varchar ade exit 引入
本文系统来源:http://www.cnblogs.com/lmg-jie/p/7596930.html
内容总结
以上是互联网集市为您收集整理的MySql基本操作全部内容,希望文章能够帮你解决MySql基本操作所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。