SphereCommunity
Mysql not connected - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Mysql not connected (/Thread-Mysql-not-connected)



Mysql not connected - admin_teclis - 08-14-2012 01:09 AM

Hi everyone, I have a problem with connecting to Mysql...

I followed the example of a user I found with the search button.

Report the script:

PHP Code:
sub-zero Wrote:
Code:
---- 
sphere.ini ----
// MySql configuration.
MYSQL=1
MySqlHost
=127.0.0.1
MySqlUser
=root
MySqlPassword
=
MySqlDatabase=sphere


Code
:
---- 
sphere_serv_triggers.scp ----
// This function is called on server startup
[FUNCTION f_onserver_start]
f_sphere_MySQL_connect


Code
:
---- 
sphere_MySQL.scp ----
[Function 
f_sphere_MySQL_connect]
DB.CONNECT
IF ( <DB.CONNECTED> )
    
SERV.LOG "Connection with MySQL...        [ OK ]"
ELSE
    
MySqlDatabase=mysql
    DB
.CONNECT
    DB
.EXECUTE "CREATE DATABASE IF NOT EXISTS `sphere`"
    
DB.EXECUTE "USE `sphere`"
    
MySqlDatabase=sphere
    serv
.f_sphere_MySQL_connect
    
//SERV.LOG "Connection with MySQL...        [ FAILED ]"
ENDIF 

But it did not appear in the log file it in the console status ok.
Obviously I did not even create the table ...
We carry the script made ​​by me to create the table:
PHP Code:
DB.EXECUTE "create table demo ( 
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
account VARCHAR(50),
name VARCHAR(50),
guild TEXT,
kills INT,
fame INT,
karma INT
);" 

What's wrong?


RE: Mysql not connected - Shaklaban - 08-16-2012 06:11 AM

MySqlDatabase=sphere

i don't know this part is works or not, it must be serv.MySqlDatabase=sphere i think.

also you have very weird if condition.

and i don't know use keyword works on sphere or not.

best is create database from phpmyadmin etc. then just write your mysql settings to sphere.ini.


RE: Mysql not connected - admin_teclis - 08-17-2012 02:31 AM

tnx for the reply...

I can just check and let you know if it works...


RE: Mysql not connected - xwerswoodx - 08-19-2012 02:57 AM

Change 127.0.0.1 to localhost and after your problem isn't solved can you write here what is the error on sphere.