To allow remote access to apache on Windows change the file: c:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
You need to allow remote access to directory C:\wamp\www like this:
<Directory "c:/wamp/www/">
ExecCGI MultiViews
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
To grant remote access to MySQL:
use mysql;
GRANT ALL PRIVILEGES ON *.* to root@'%' IDENTIFIED BY 'sys';
flush privileges;
To see what is already allowed do this:
use mysql;
select user,host from user;
+------+-----------+
| user | host |
+------+-----------+
| root | |
| root | % |
| | localhost |
| root | localhost |
+------+-----------+
4 rows in set (0.00 sec)
“empty” places are nulls here. ‘%’ means from any host.
nice blog........
ReplyDeleteTo enable mysql remote access sometimes you need to edit the file:
ReplyDeletevi /etc/my.cnf
comment the line "skip-networking"
bind-address=YOUR-SERVER-IP
On Archlinux you have to edit the file: /etc/hosts.allow
as well. Add:
mysqld : ALL : ALLOW
mysqld-max : ALL : ALLOW
mysql -u root
ReplyDeleteFLUSH PRIVILEGES;
SET PASSWORD FOR root@'localhost' = PASSWORD('newpassword');
UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';
(remember to user '' instead of "")
i'm working with a wamp.. where should i make
ReplyDeletethe changes to a file to allow the mysql?
MySQL 4.0 add user:
ReplyDeleteuse mysql;
grant all on dbname to 'username'@'localhost' identified by 'yourpassword';
Thanks. big help
ReplyDeleteThis command creates a user:
ReplyDeleteCREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
INSERT INTO user (Host,User,Password) VALUES('%','user','pass');
ReplyDeleteUPDATE mysql.user SET Password=PASSWORD('pass') WHERE User='user';
FLUSH PRIVILEGES;
Hi thanks a lot for the good info, but I also had to Port Forward to my Internal IP address the port 80 (the one Apache uses) through the router page, otherwise my friends couldn not enter my website app hosted from WAMP. Thanks!
ReplyDeleteAh and just also to remind, that if you have done everything as said and working good, when you paste the public IP address on the browser url from the server machine, you might get redirected to the router page, which is fine and normal, most recent routers doesn't allow that, so don't go crazy as I went trying to figure out. It will work if you enter from a network different from the server machine. Cheers.
ReplyDeleteI created user user@'%'. But I can not connect with:
ReplyDeletemysql_connect('localhost:3306', 'user', 'password');
When I created user user@'localhost', I was able to connect. Why? Doesn't '%' mean from ANY host?
thanks.. its nice demo
ReplyDeleteNice description......... Thanks
ReplyDelete