linux下mysql的使用
启动mysql: /etc/rc.d/init.d/mysql start
修改密码: 格式:mysqladmin -u用户名 -p旧密码 password 新密码
使用密码登录: mysql -u root -p
显示数据库: show databases;
选择数据库: use 数据库名;
显示表: show tables;
显示表结构: descibe 表名;
远程登录mysql需要开启权限:
grant 权限名(all表全部) on 库名(*表全部).表名(*表全部) to 用户名@"%"(%表全部IP) identified by "密码"
例如: grant all on *.* to root@"%" identified by "111111"
查看mysql的版本信息: \s
判断是否支持分区: show variables like '%partition%'
相关文档:
解决MySQL不允许从远程访问的方法
2009-06-04 13:11
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
Sql代码 复制代码
1. mysql -u root -pvmwaremysql>us ......
mysql 5.0存储过程学习总结
一.创建存储过程
1.基本语法:
create procedure sp_name()
begin
………
end
2.参数传递
二.调用存储过程
1.基本语法:call sp_name()
注意:存储过程名称后面必须加括号,哪怕该存储过程没有参数传递
三.删除存储过程
1.基本语法:
drop procedure sp_name// ......
昨天,我突然想把一个数据库里的每个表,以及每个表的非空总纪录数存在另一个表里面。
首先,创建了一个存放数据的表:
create table tables
(
name varchar(50),
number int
);
insert into tables select table_name from information_schema.tables where table_shema = 'test';
但是不知道有没有方法,将非空的 ......
CREATE TABLE `taa` (
`year` varchar(4) DEFAULT NULL,
`month` varchar(2) DEFAULT NULL,
`amount` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf
"year","m ......
mysql设置密码和修改密码:
/usr/local/mysql/bin/mysqladmin -uroot password 123456 第一次设密码。
mysqladmin -uroot -p password mypasswd 修改密码
输入这个命令后,需要输入root的原密码,然后root的密码将改为mypasswd。
就是mysql5导出的有default-charact的设置,mysql4不支持,需要加skip-opt参数,如:
my ......