ubuntu下mysql的简单操作
来源:互联网 发布:网络dns错误怎么办 编辑:程序博客网 时间:2024/06/09 06:05
1,安装
sudo apt-get install mysql-server 数据库服务器,用于管理数据库与表,控制用户访问,以及处理 SQL 查询
apt-get isntall mysql-client MySQL 客户端程序,实现用户与服务器的连接与交互功能
sudo apt-get install libmysqlclient-dev编译使用 MySQL 的其他程序的过程中会用到的一些库及头文件。
2,管理
1,关闭mysql服务器
cd /usr/bin./mysqladmin -u root -p shutdown
2,启动mysql服务器
/etc/init.d/mysql start
3.连接mysql服务器
mysql -u root -p
4,确定mysql服务器是否运行
ps -ef |grep mysqld
5,创建一个名为TEST的数据库
mysqladmin -u root -p create TEST
6,删除一个名为TEST的数据库
mysqladmin -u root -p drop TEST //显示是否删除数据库的时候记得输入y!
7,选择名为test的数据库
mysql -u root -pshow databases;//检查是否有test这个数据库use test;
3,简单操作
1,创建一个也test_id为主键,含有test_id和test_name的表
CREATE TABLE test( -> test_id INT NOT NULL AUTO_INCREMENT, -> test_name VARCHAR(40) NOT NULL, -> PRIMARY KEY (test_id));
2,删除表test
drop table test ;
3,插入数据
insert into test (test_name) values ("zk");//没有写test_id是因为他是AUTO_INCREMENT
4,查询数据
select * from test ;
where查询,查询test_id为1的所有数据
select * from test where test_id='1';
5,更改数据
更改test_id为1的test_name为zklove
update test -> set test_name='zklove' -> where test_id='1';
6,删除数据
删除test_id为2的所有数据
delete from test where test_id=2;
7,查询表的结构
show columns from 表名;
接
http://blog.csdn.net/github_36413952/article/details/78363320
阅读全文
0 0
- ubuntu下mysql的简单操作
- ubuntu下mysql的简单操作 二
- Ubuntu下MySQL简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下安装MySQL及简单操作
- Ubuntu下的Mysql操作
- ubuntu下mysql可视化工具mysql-workbench简单操作
- ubuntu下 MySQL操作
- ubuntu下mysql操作
- c++之关键字static
- 只在堆上对象和栈上对象
- JAVA中线程同步的方法(7种)汇总
- python打赢乘法表
- Guessing the Dice Roll HDU
- ubuntu下mysql的简单操作
- PV操作解决吃水果问题(Java实现)
- 求数组中元素第一次出现的索引值
- 学习testNG之报错-A JNI error has occurred
- 模板方法模式
- 有没有大神能够逐行解释一下代码?Delphi
- File类的概述和常用功能:File类的创建和删除功能:File类的判断功能:File类的获取功能和修改名字功能File的重要获取功能
- 单片机中常见英文缩写(51为例)
- 单链表逆置实现(C++)