作者:姚若薇_453 | 来源:互联网 | 2014-06-09 00:50
Mysql那些事儿之(一)mysql的安装一、Linux下安装Mysql数据库首先下载Linux的Mysql安装包mysql-5.0.85.tar.tar将下载好的安装包上传至Linux的/usr/sid/mysql目录然后继续如下操作:www.2cto.com安装步骤:...S
Mysql那些事儿之(一)mysql的安装
一、Linux下安装Mysql数据库
将下载好的安装包上传至
Linux的 /usr/sid/mysql 目录
然后继续如下操作:
www.2cto.com
安装步骤:
--进入Mysql的安装目录
cd /usr/sid/mysql
--添加一个Mysql组
groupadd mysql
--在Mysql组里添加一个Mysql用户
useradd -g mysql mysql
安装:
--解压Mysql安装包
tar zxvf mysql-5.0.85.tar.tar
--进入mysql-5.0.85目录
cd mysql-5.0.85
--配置Mysql的安装路径与相关参数
./configure --prefix=/usr/local/sunnyboysac/mysql -with-extra-charsets=gbk -with-extra-charsets=all -with-named-curses-libs=/usr/lib/libncurses.so.5 -with-innodb
--编译
make
--安装
make install
配置步骤:
--进入mysql解压的目录
cd mysql-5.0.85
--拷贝文件
cp support-files/my-large.cnf /etc/my.cnf
vi /etc/my.cnf
修改内容
添加一行
default-storage-engine=INNODB
并把innodb相关的注释(#)去掉
改写部分修改后的形式如下
#bdb_max_lock = 100000
default-storage-engine=INNODB
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/eetrust/mysql/var/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/eetrust/mysql/var/
innodb_log_arch_dir = /usr/local/eetrust/mysql/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
www.2cto.com
进入mysql目录
cd /usr/local/eetrust/mysql/bin
添加用户mysql
./mysql_install_db --user=mysql
--设置用户密码
./mysqld_safe --user=mysql &
./mysqladmin -u root password sunnyboysac
--设置mysql自启动
--进入解压目录
--拷贝文件
cd /usr/sid/mysql/mysql-5.0.85
cp support-files/mysql.server /etc/rc.d/init.d/mysql
--修改权限
cd /etc/rc.d/init.d
chmod +x /etc/rc.d/init.d/mysql
--设置自启动
chkconfig --add mysql
chkconfig mysql on
--将mysql的bin添加到/etc/profile的path中
vi /etc/profile
--在path后面加入如下内容
:/usr/local/eetrust/mysql/bin
--应用
source /etc/profile
mysql -uroot –psunnyboysac
--给mysql的用root用户授权,使其远程可以访问
grant all on *.* to 'root'@'%' identified by 'mysqladmin';
grant all on *.* to 'root'@'%' identified by 'sunnyboysac';
GRANT USAGE ON *.* to root@'%' IDENTIFIED BY 'sunnyboysac';
--刷新
flush privileges;
如果还连不上,关掉防火墙
service iptables stop
www.2cto.com
验证:
service mysql start
退出窗口重新登录
用mysql命令