[root@localhost]# tar zxvf mysql-5.0.22.tar.gz
[root@localhost]# cd mysql-5.0.22 mysql
[root@localhost]# mkdir -p /soft/mysql/data
不要执行词句,执行此句不会有gbk编码
------ [root@localhost]# ./configure --prefix=/soft/mysql --with-charset=gb2312 --with-raid --localstatedir=/soft/mysql/data
执行此句会有gbk编码
[root@localhost]# ./configure --prefix=/soft/mysql --localstatedir=/soft/mysql/data --with-charset=gbk --with-collation=gbk_bin --with-extra-charsets=big5,ascii,gb2312,gbk,utf8,latin1;
[root@localhost]# make
[root@localhost]# make install
[root@localhost]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost]# cp support-files/mysql.server /etc/init.d/mysqld //copy启动的mysqld文件
[root@localhost]# chmod 700 /etc/init.d/mysqld
[root@localhost]# ./scripts/mysql_install_db --user=root
[root@localhost]# ./scripts/mysqld_safe --user=root & //
[root@localhost]# cd /soft/mysql
[root@localhost]# chown -R root .
[root@localhost]# chown -R root data
[root@localhost]#
[root@localhost]# ./bin/mysqladmin -u root password 'nstl' //(更改管理员密码,默认为空)
[root@localhost]# ./bin/mysql -uroot -p密码 //(输入密码,默认密码为空,直接回车即可)
--修改mysql文件令大写都转换为小写
vi /etc/my.cnf
在
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
下加一行 lower_case_table_names=1
重新启动
# /etc/init.d/mysqld stop;
# cd /usr/java/mysql-5.0.22
# ./scripts/mysqld_safe --user=root &
# /etc/init.d/mysqld start;
停止
# /etc/init.d/mysqld stop;
错误日志
/soft/mysql/data/localhost.localdomain.err
数据库用户授权
在mysql 控制台中 GRANT all ON *.* TO flushl@localhost IDENTIFIED BY "password"
导出(本次施工已经有导出文件了在cvs 项目实施/服务站)
mysql -h localhost -u root -p db > /usr/java/db.sql;
show databases;
导入
先到mysql控制台创建db数据库
create database db;
方法1、mysql -h localhost -u root -p db < /usr/java/db.sql;
方法2、进入mysql控制台 source /usr/java/db.sql;