MySql基础(1)
时间:2009-07-24 来源:alexzhu99
环境redhat 5.2
一、使用源码包安装Mysql
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar -xzvf mysql-5.0.18.tar.gz
shell> cd mysql-5.0.18
shell> ./configure --prefix=/usr/local/mysql --with-charset=gb2312
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql 用mysql_install_db创建MySQL授权表
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & 后台启动MySQL
二、连接和操作。
shell> mysql
mysql> SHOW DATABASES;
mysql> USE test
Database changed
创建并选择数据库
mysql>CREATE DATABASE zwt;
Query OK, 1 row affected (0.03 sec)
mysql> use zwt
Database changed
mysql> show tables;
Empty set (0.00 sec)
相关阅读 更多 +