1. 安装
/etc/rd.d/init.d/mysql start或者
步骤1:进入到
安装目录下面执行:
./mysqld_safe &启动mysql数据库
步骤2:
./mysql -uroot, 或者加入环境变量/etc/profile
export MySQL_HOME=/usr/local/mysql
export PATH=$MySQL_HOME/bin:$PATH
GRANT ALL PRIVILEGES ON *.*
TO 'discuz'@
'localhost' IDENTIFIED
BY 'discuz' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.*
TO 'discuz1'@
'%' IDENTIFIED
BY 'discuz1' WITH GRANT OPTION;
在完成mysql对用户的授权之后,需要进行 flush privileges;操作,因为mysql在读取mysql的user表之后,后面一直处于内存之中, 是权限生效需要 flush privileges。
查看授权:show grants
create user,
grant, phpmyadmin
revoke update, mysqladmin
\s或者status
创建表
user的语句:show
create table user show grants;
password()函数
/etc/rd.d/init.d/mysql stop或者
show tables;
show databases;
use 数据库名;
desc user;
describle 表名;或
desc 表名;
'#',
'--'均可用于注释create database school;drop database school;drop database if exists school;create table student #建立学生表 ( id int(5) auto_increment not null primary key, name char(10) not null, address varchar(50) default '清华大学' year date );select left(address,10) from student; 只看address的前10个字符select count(*) from student;统计记录数select (100+98+99)/3;当计算器来用select """hello";结果为"hello, 将2个双引号当做1个双引号 或select "\"hello";结果为"helloselect '''hello';结果为'helloselect '\'hello';结果为'helloselect 0xa+0; 结果为10select 0x5061756c; 结果为Paulselect x'4d7953514c';结果为MySQLselect hex('cat');结果为636174select TRUE,true, FALSE,false;结果为1,1,0,0 select * from 'select' where 'select'.id>100;create table orders('my orders' varchar(100)); 删除表:drop table student; 本文转自 tianya23 51CTO博客,原文链接:http://blog.51cto.com/tianya23/258755,如需转载请自行联系原作者