Mysql数据库安装
./configure \ --prefix=/application/mysql5.1.72 \ --with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \ --localstatedir=/application/mysql5.1.72/data \ --enable-assembler \ --enable-thread-safe-client \ --with-mysqld-user=mysql \ --with-big-tables \ --without-debug \ --with-pthread \ --enable-assembler \ --with-extra-charsets=complex \ --with-readline \ --with-ssl \ --with-embedded-server \ --enable-local-infile \ --with-plugins=partition,innobase \ --with-mysqld-ldflags=-all-static \ --with-client-ldflags=-all-static
出现的问题:
yum -y install ncurses-devel yum install gcc-c++
[root@c-mysql mysql-5.1.72]# ln -s /application/mysql5.1.72 /application/mysql [root@c-mysql mysql-5.1.72]# ll /application/mysql/ #配置文件 [root@c-mysql mysql-5.1.72]# ll support-files/my*.cnf -rw-r--r--. 1 root root 4746 8月 10 10:47 support-files/my-huge.cnf -rw-r--r--. 1 root root 19779 8月 10 10:47 support-files/my-innodb-heavy-4G.cnf -rw-r--r--. 1 root root 4720 8月 10 10:47 support-files/my-large.cnf -rw-r--r--. 1 root root 4731 8月 10 10:47 support-files/my-medium.cnf -rw-r--r--. 1 root root 2499 8月 10 10:47 support-files/my-small.cnf #初始化数据库 [root@c-mysql mysql-5.1.72]# groupadd mysql [root@c-mysql mysql-5.1.72]# useradd mysql -g mysql -M -s /sbin/nologin /虚拟用户,不创建家目录,属于mysql组 [root@c-mysql mysql-5.1.72]# ll cp support-files/my-small.cnf /etc/my.cnf [root@c-mysql mysql-5.1.72]# mkdir /application/mysql/data [root@c-mysql mysql-5.1.72]# chown -R mysql.mysql /application/mysql [root@c-mysql mysql-5.1.72]# /application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
#开发者自带脚本 [root@c-mysql mysql-5.1.72]# cp ~/tools/mysql-5.1.72/support-files/mysql.server /etc/init.d/mysqld [root@c-mysql mysql-5.1.72]# vi /etc/init.d/mysqld [root@c-mysql mysql-5.1.72]# chmod +x /etc/init.d/mysqld 添加: basedir=/application/mysql datadir=/application/mysql/data [root@c-mysql mysql-5.1.72]# chkconfig --add mysqld [root@c-mysql mysql-5.1.72]# chkconfig on [root@c-mysql mysql-5.1.72]# /etc/init.d/mysqld start //启动 [root@c-mysql mysql-5.1.72]# pkill mysqld //强行关闭 [root@c-mysql mysql-5.1.72]# mysqladmin shutdown //标准关闭 #启动数据库 [root@c-mysql mysql-5.1.72]# vim /etc/profile PATH="/application/mysql/bin/:$PATH" alias grep='grep --color=auto' [root@c-mysql mysql-5.1.72]# source /etc/profile [root@c-mysql mysql-5.1.72]# /application/mysql/bin/mysqld_safe & [root@c-mysql mysql-5.1.72]# netstat -lntup|grep mysql [root@c-mysql mysql-5.1.72]# mysql mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec)
#设置密码 /application/mysql/bin/mysqladmin -u root password '123456' #登陆 [root@c-mysql mysql-5.1.72]# mysql -u root -p #查看版本 mysql> selectversion(); #查看用户 mysql> select user(); #删除test数据库 mysql> drop database test; #删除空用户 mysql> select user,host from mysql.user; +------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | | c-mysql | | root | c-mysql | | | localhost | | root | localhost | +------+-----------+ 5 rows in set (0.00 sec) mysql> drop user ""@localhost; Query OK, 0 rows affected (0.00 sec) #修改 update mysql.user set host='localhost' where host='httpd' and user='root'; flush privileges; #mysql忘记密码,修改方法 [root@c-mysql mysql-5.1.72]#killall mysqld -9 [root@c-mysql mysql-5.1.72]# /application/mysql/bin/mysqld_safe --skip-grant-table & update mysql.user set password=PASSWORD("123456") where host='localhost' and user='root'; flush privileges;
#安装PHP(apache服务器上安装) 安装PHP基础依赖包,安装前修改epel源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo 安装环境准备 yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y 检查是否安装上 rpm -qa zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel 安装libiconv tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make && make install && cd ../ #编译PHP ./configure \ --prefix=/application/php5.3.27 \ --with-apxs2=/application/apache/bin/apxs \ --with-mysql=/application/mysql \ --with-xmlrpc \ --with-openssl \ --with-zlib \ --with-freetype-dir \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-iconv=/usr/local/libiconv \ --enable-short-tags \ --enable-sockets \ --enable-zend-multibyte \ --enable-soap \ --enable-mbstring \ --enable-static \ --enable-gd-native-ttf \ --with-curl \ --with-xsl \ --enable-ftp \ --with-libxml-dir [root@A-host php-5.3.27]# make && make install [root@A-host php-5.3.27]# ln -s /application/php5.3.27/ /application/php
#PHP配置文件 [root@A-host php-5.3.27]# ls php.ini-* php.ini-development //开发人员使用 php.ini-production //生产环境使用 [root@A-host php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
#Apache整合PHP [root@A-host php-5.3.27]# vim /application/apache/conf/httpd.conf +98 ServerName 127.0.0.1:80 再跳到311行,增加这两行 AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps 再到65行,改用户,不要使用daemon User www Group www [root@A-host php-5.3.27]# groupadd www [root@A-host php-5.3.27]# useradd www -g www -M -s /sbin/nologin 再到166行,改默认首页 index.php chown -R www.www /var/html/www 重启 apache /application/apache/bin/apachectl restart [root@A-host www]# /application/apache/bin/apachectl graceful
停留在世界边缘,与之惜别