MySQL学习笔记(1)
时间:2006-12-12 来源:bitterness
www.mysql.com
rpm -ivh MySQL*
-------------
tar安装
tar zxvf mysql-.tar.gz
cd mysql-..
./configure
make //编译
make install
mysql_install_db
---------------------
rpm安装
service mysql start|stop
/etc/rc.d/init.d/mysql start|stop
----------------------
tar安装
mysqld_safe&
safe_mysqld&
----------
mysqladmin shutdown
----------
测试
mysqladmin ping
版本
mysqladmin version
系统数据库mysql与测试数据库test
mysqlshow
-------------------
连接mysql
mysql -h 主机地址 -u 用户名 -p 用户密码
mysql
mysql -uroot -p //root不是linux的root
mysql -h100.0.0.0 -uroot -p
mysql mysql
---------
show databases;
use mysql;
show tables;
---
describe 表名;
desc user;
---------------
exit
============
mysql DCL
--------
数据库数据目录
cd /var/lib/mysql/
建库
create datebase school;
删除
drop datebase school;
drop database if exists school;
-------
use school;
create table teacher
(
Id int(5) auto_increment not null primary key,
name char(10) not null,
address varchar(50) default 'da xue'
year date
);
---
所有
select * from teacher;
投影
select id,year from teacher;
预览
select id,left(year,xxxx-xx-xx) from teacher;
//left函数,取某个字段
统计
select count(*) from teacher;
--------
PHPMYADMIN
--------
vi httpd.conf
Alias /phpmyadmin/ "/usr/local/src/phpMyAdmin2.5.7"
------
service httpd restart
--
打开浏览器 http://ip/phpmyadmin
需要把一些用户删除和加ROOT密码
---
然后
vi config.inc.php
$cfg['servers'][$i]['auth_type'] = 'http'
$cfg['servers'][$i]['password'] = '123456' //123456为设置的密码
再次运行
http://ip/phpmyadmin 会弹出对话框,输入用户名和密码就OK了
==========================
2006.11.22 #####################################################
mount /dev/hdb10 /mnt/g -t vfat -o iocharset=gb2312
也可以在fstab中加入:
/dev/hdb10 /mnt/g vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
------------
或用FTP
######################################################
rpm -ivh MySQL*
-------------
tar安装
tar zxvf mysql-.tar.gz
cd mysql-..
./configure
make //编译
make install
mysql_install_db
---------------------
rpm安装
service mysql start|stop
/etc/rc.d/init.d/mysql start|stop
----------------------
tar安装
mysqld_safe&
safe_mysqld&
----------
mysqladmin shutdown
----------
测试
mysqladmin ping
版本
mysqladmin version
系统数据库mysql与测试数据库test
mysqlshow
-------------------
连接mysql
mysql -h 主机地址 -u 用户名 -p 用户密码
mysql
mysql -uroot -p //root不是linux的root
mysql -h100.0.0.0 -uroot -p
mysql mysql
---------
show databases;
use mysql;
show tables;
---
describe 表名;
desc user;
---------------
exit
============
mysql DCL
--------
数据库数据目录
cd /var/lib/mysql/
建库
create datebase school;
删除
drop datebase school;
drop database if exists school;
-------
use school;
create table teacher
(
Id int(5) auto_increment not null primary key,
name char(10) not null,
address varchar(50) default 'da xue'
year date
);
---
所有
select * from teacher;
投影
select id,year from teacher;
预览
select id,left(year,xxxx-xx-xx) from teacher;
//left函数,取某个字段
统计
select count(*) from teacher;
--------
PHPMYADMIN
--------
vi httpd.conf
Alias /phpmyadmin/ "/usr/local/src/phpMyAdmin2.5.7"
------
service httpd restart
--
打开浏览器 http://ip/phpmyadmin
需要把一些用户删除和加ROOT密码
---
然后
vi config.inc.php
$cfg['servers'][$i]['auth_type'] = 'http'
$cfg['servers'][$i]['password'] = '123456' //123456为设置的密码
再次运行
http://ip/phpmyadmin 会弹出对话框,输入用户名和密码就OK了
==========================
2006.11.22 #####################################################
mount /dev/hdb10 /mnt/g -t vfat -o iocharset=gb2312
也可以在fstab中加入:
/dev/hdb10 /mnt/g vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
------------
或用FTP
######################################################
相关阅读 更多 +