Mysql那些事儿之(一)mysql的安装_MySQL
程序员文章站
2022-04-13 20:53:22
...
bitsCN.com
Mysql那些事儿之(一)mysql的安装 一、Linux下安装Mysql数据库首先下载Linux的Mysql安装包mysql-5.0.85.tar.tar
将下载好的安装包上传至Linux的 /usr/sid/mysql 目录然后继续如下操作: 安装步骤:--进入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 = 100000default-storage-engine=INNODB# Uncomment the following if you are using InnoDB tablesinnodb_data_home_dir = /usr/local/eetrust/mysql/var/innodb_data_file_path = ibdata1:10M:autoextendinnodb_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 highinnodb_buffer_pool_size = 256Minnodb_additional_mem_pool_size = 20M# Set .._log_file_size to 25 % of buffer pool sizeinnodb_log_file_size = 64Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 50 进入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.85cp support-files/mysql.server /etc/rc.d/init.d/mysql--修改权限cd /etc/rc.d/init.dchmod +x /etc/rc.d/init.d/mysql--设置自启动chkconfig --add mysqlchkconfig mysql on--将mysql的bin添加到/etc/profile的path中vi /etc/profile--在path后面加入如下内容:/usr/local/eetrust/mysql/bin --应用source /etc/profilemysql -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 验证: service mysql start 退出窗口重新登录用mysql命令 bitsCN.com
Mysql那些事儿之(一)mysql的安装 一、Linux下安装Mysql数据库首先下载Linux的Mysql安装包mysql-5.0.85.tar.tar
将下载好的安装包上传至Linux的 /usr/sid/mysql 目录然后继续如下操作: 安装步骤:--进入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 = 100000default-storage-engine=INNODB# Uncomment the following if you are using InnoDB tablesinnodb_data_home_dir = /usr/local/eetrust/mysql/var/innodb_data_file_path = ibdata1:10M:autoextendinnodb_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 highinnodb_buffer_pool_size = 256Minnodb_additional_mem_pool_size = 20M# Set .._log_file_size to 25 % of buffer pool sizeinnodb_log_file_size = 64Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 50 进入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.85cp support-files/mysql.server /etc/rc.d/init.d/mysql--修改权限cd /etc/rc.d/init.dchmod +x /etc/rc.d/init.d/mysql--设置自启动chkconfig --add mysqlchkconfig mysql on--将mysql的bin添加到/etc/profile的path中vi /etc/profile--在path后面加入如下内容:/usr/local/eetrust/mysql/bin --应用source /etc/profilemysql -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 验证: service mysql start 退出窗口重新登录用mysql命令 bitsCN.com