Jump to content

[HELP]MySQl


sckatchof

Recommended Posts

hi guys i have problem with connect to mysql :

function getMySQLconnection() 
    MySQlc= dbConnect( "mysql", "dbname=Khodja;host=127.0.0.1", "username", "password", "share=1" ) 
    if MySQlc then  
        outputDebugString ( "Server is now connected with the MySQL database!") 
        exports.TNSDxChatBox:CreatDxChatBoxForPlayer(root, "Server is now connected with the MySQL database!", 0,255,0) 
        return true 
    else 
        exports.TNSDxChatBox:CreatDxChatBoxForPlayer(root, "Connection with the MySQL database failed!", 255,0,0) 
        outputDebugString ( "Connection with the MySQL database failed!" ) 
        return false 
end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getMySQLconnection ) 

Error : MySQl/mysql.lua line:2: dbConnect failed; Host 'DELL-PC' is not allowed to connect to this Mysql database server 

Link to comment
oh that's no good. could you connect before? did you remove the root account before adding a new one? is the mysql server running on the same server as the php server with phpMyAdmin? windows or linux?

windows 7 but now i change Mysql config it's work with 127.0.0.1/phpMyAdmin but with localhost/phpMyAdmin don't work

Forbidden 
  
You don't have permission to access /phpmyadmin/ on this server. 

1171140413.png

Link to comment

ah ok

that doesnt have to be a problem, but if you want it fixed there's two possibilities that may cause the problem:

1) your dns server doesnt resolve localhost right; to fix:

open start menu and type notepad, then right-click on it and run as admin

then choose Open file from notepad and put this in the box for the file name and press enter:

%windir%\System32\drivers\etc 

then choose Show all files and then pick "hosts"

hosts.jpg

then manually add to the end of the file

127.0.0.1       localhost 

and save and check if it works

if theres another entry for localhost but the ip is not 127.0.0.1 or ::1 write it down and remove it and maybe investigate if it wasnt added by a virus

2) the config of your webserver program somehow blocks the use of that hostname

but this is probably not it and its pretty advanced

troll spoiler

actually that localhost thing may be the very cause that you got that error of "Host 'DELL-PC' is not allowed to connect to this Mysql database server" in the first place. is that solved now? I think you should really check your host file (step 1) and check if it doesnt weirdly resolve to your external ip or an internal network ip

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...