Mysql allow login ip

標準

mysql> use mysql

mysql> grant all on *.* to root@’your ip′ identified by ‘root-password’;

GRANT ALL PRIVILEGES ON *.* TO ‘myuser’@’%’ WITH GRANT OPTION;

mysql> FLUSH PRIVILEGES;

 

 

 

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.

Stop the MySQL Server.

sudo /etc/init.d/mysql stop

Start the mysqld configuration.

sudo mysqld –skip-grant-tables &

Login to MySQL as root.

mysql -u root mysql

Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD(‘YOURNEWPASSWORD’) WHERE User=’root’; FLUSH PRIVILEGES; exit;

廣告

CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL

標準

1、安装Apahce、PHP、MySQL和PHP连接MySQL数据库的包:
# yum -y install httpd php mysql mysql-server php-mysql

2、安装Apache常用扩展包:
# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

3、安装PHP常用扩展组包:
# yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel

4、安装MySQL的常用扩展包:
# yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

5、安装Tomcat6相关软件包:
# yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps tomcat6-docs-webapp tomcat6-javadoc
说明:如果是CentOS 5.x,yum安装的是Tomcat5版本,如下:
# yum -y install tomcat5 tomcat5-webapps tomcat5-admin-webapps tomcat5-docs-webapp tomcat5-javadoc

6、全部软件包一键安装命令如下:
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel mysql-connector-odbc mysql-devel libdbi-dbd-mysql tomcat6 tomcat6-webapps tomcat6-admin-webapps tomcat6-docs-webapp

7、配置Apache、MySQL、Tomcat服务开机自启动:

# chkconfig httpd on
# chkconfig mysqld on
# chkconfig tomcat6 on

8、重启Apache、MySQL、Tomcat服务:

# /etc/init.d/httpd restart
# /etc/init.d/mysqld restart
# /etc/init.d/tomcat6 restart

说明:

Apache的配置文件是/etc/httpd/conf/里
modules放在/usr/lib/httpd/里
php的配置文件在/etc/php.d/里和/etc/php.ini
php的modules放在/usr/lib/php/modules里
MySQL的配置文件在/etc/my.cnf
Tomcat6安装目录位于/user/share/tomcat6/里
Tomcat6的配置文件位于/etc/tomcat6/里

9、在Apache的网站根目录下(默认为/var/www/html/)建个PHP环境测试页面:
# vim phpinfo.php
输入:
<?php
phpinfo();
?>

在浏览器访问phpinfo.php,如下图所示:

10、在浏览器输入http://你的IP:8080,可以看到Apache SoftWare Foundation页面,如果看不到,请检查是否防火墙问题。如下图所示:

11、Apache与Tomcat的整合:

如果网站需同时整合Apache与Tomcat可以使用JK或者Proxy方式,使用vim编辑proxy_ajp.conf文件:
# vim /etc/httpd/conf.d/proxy_ajp.conf

输入以下内容:
ProxyPass /tomcat/ ajp://localhost:8009

保存后重启Apache和Tomcat服务:

# /etc/init.d/httpd restart
# /etc/init.d/tomcat6 restart

12、在浏览器输入http://你的IP/tomcat/,可以看到Apache SoftWare Foundation页面。

13、Tomcat Manager用户管理设置:
# vim /etc/tomcat6/tomcat-users.xml
把这段配置:

<tomcat-users>
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->

<!-- The host manager webapp is restricted to users with role "admin" -->
<!--<user name="tomcat" password="password" roles="admin" />-->
<!-- The manager webapp is restricted to users with role "manager" -->
<!--<user name="tomcat" password="password" roles="manager" />-->
</tomcat-users>

修改为如下图所示:

意思是在其中添加管理员角色manager,以及管理员账户admin和密码888888。
最后重启Tomcat服务,再进入管理页面的时候,用管理员账户admin和密码888888,登陆成功

Other method:

# cat /etc/redhat-release
CentOS release 6.2 (Final)

下载jdk和tomcat

#wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin

#wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz

#vi /etc/profile 添加以下几行

JAVA_HOME=”/usr/local/jdk”
CLASS_PATH=”$JAVA_HOME/lib:$JAVA_HOME/jre/lib”
PATH=”.:$PATH:$JAVA_HOME/bin”
CATALINA_HOME=”/usr/local/tomcat”
export JAVA_HOME CATALINA_HOME

#source /etc/profile

#chmod u+x jdk-6u25-linux-x64.bin

#./jdk-6u25-linux-x64.bin

#mv  jdk1.6.0_25  /usr/local/jdk

# java -version

java version “1.6.0_25″
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)

#tar -xzvf  apache-tomcat-7.0.23.tar.gz

#mv apache-tomcat-7.0.23 /usr/local/tomcat/

#/usr/local/tomcat/bin/startup.sh