mysql-5.1.40-linux-i686-glibc23.tar.gz安装笔记
1.首先添加mysql用户组
Shell代码
shell> groupadd mysql
2.添加mysql用户,并指定到mysql用户组
Shell代码
shell> useradd -g mysql mysql
3.解压缩mysql-version.tar.gz到安装目录(/usr/local/)
Shell代码
shell> cd /usr/local
#shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
直接解压
4.为创建mysql软连接mysql-VERSION-OS
Shell代码
#shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
5.设定mysql安装目录权限,设置owner为mysql
Shell代码
shell> chown -R mysql .
6.设定mysql安装目录权限,设置group为mysql
Shell代码
shell> chgrp -R mysql .
7.执行mysql系统数据库初始化脚本
Shell代码
shell> scripts/mysql_install_db
如报错指明路径
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
8.回收mysql用户在安装目录下的权限,重新分配给root
Shell代码
shell> chown -R root .
9.设定data目录权限,分配给mysql用户,为了mysql程序能读写data目录下的文件
Shell代码
shell> chown -R mysql data
10.使用mysql帐号启动mysql应用
Shell代码
shell> bin/mysqld_safe --user=mysql &
11.设置root密码
Shell代码
shell> bin/mysqladmin -u root password '123123'
12.登录mysql
Shell代码
shell> bin/mysql -u root -p
Enter password:
登录成功会看到:
Shell代码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 229
Server version: 5.1.40-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
这时mysql已经装好了,可以查看数据库了,但在正式使用数据库开发与部署的时候还需要做一些工作:
1.设定配置文件my.cnf
按照需求copy my-***.cnf到/etc/my.cnf
2.修改默认字符集utf8
(1).[client]下加入default-character-set=utf8
(2).[mysqld]下加入default-character-set=utf8
set-variable = default_character_set=gbk
3.设置默认存储引擎
mysql for linux的版本默认使用的数据库引擎是MyISAM,但只有InnoDB引擎支持事务,
所以需要修改配置:
(1).[mysqld]下加入default-storage-engine=INNODB
4.配置innodb参数
(1).找到# Uncomment the following if you are using InnoDB tables
去掉innodb_*下的所有#
(2).如果安装mysql的目录不是默认的,则需要修改
# mysql 默认安装目录为 /usr/local/mysql/
# mysql 默认表空间目录安装目录为 /usr/local/mysql/data/
innodb_data_home_dir=/usr/local/database/mysql/data/
innodb_log_group_home_dir=/usr/local/database/mysql/data/
5.设置系统服务
让linux启动的时候就启动mysql服务
Shell代码
shell> cd /usr/local/mysql/
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chmod 777 /etc/init.d/mysql
shell> chkconfig --add mysql
shell> chkconfig --level 35 mysql on
6.重启MySQL服务
Shell代码
shell> service mysql restart
完成
ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server
mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql刷新权限
flush privileges
防火墙配置
/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state ――state NEW -m tcp -p tcp ――dport 22 -j ACCEPT
service iptables start
nginx 安装
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool-ltdl-devel pcre-devel
./configure --prefix=/opt/server/nginx --without-http-cache --with-http_ssl_module --with-openssl=/opt/server/openssl-1.0.0j
错误提示:./configure: error: the HTTP gzip module requires the zlib library.
yum install -y zlib-devel
错误提示:./configure: error: SSL modules require the OpenSSL library.
下载 http://www.openssl.org/source/ 解压指向就行
启动nginx时,提示:error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
32位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib
64位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib64
重启 ./sbin/nginx -s reload