Jump to content
  • 0

Installation MySQL Error (Could not connect to database)


l0gic

Question

Hi all,

 

I've seen this question answered a few times for people but unfortunately I've yet to resolve the issue.

 

I recently downloaded the free trial, and I'm attempting to set it up. I'm at the install.php page, step 3 where I'm supposed to be giving my database info so WHMCS can set all the tables up, etc. I'm putting in the correct info as far as I know, but I keep getting back the following error:

 

Could not connect to the database - check the database connection details you entered and go back and correct them if necessary

 

I've checked the username, the database name, and the password multiple times. I've deleted and remade both the user and the database multiple times. I'm using Plesk, and since I'm creating these databases under my domain's plesk account in plesk (because I manage my webhost domain from within plesk) I thought I was doing the right thing.

 

My box is dedicated to me, so I have no problems going in and doing whatever I want. I'm running Windows, but I didn't think that would be an issue.

 

I'm at my wit's end. I can login to the database through the command line utility using the username and password I supplied to WHMCS. So why can't WHMCS connect to this same database?

 

If you guys need any more info, please let me know. This will probably decide whether I buy the software or not.

Link to comment
Share on other sites

Recommended Posts

  • 0

Hi - I'm assuming that you are trying to access the DB with a user name and password set up as a "Database User" in Plesk, not with your hosting account user name and password.

 

Have you tried changing the password to something simple - is it possible that there is a weird character in the password that is causing the error?

 

To verify the setup from the apache side of things, you could try installing phpMyAdmin in your WHMCS directory and then try to access the database using the same details you are using for WHMCS.

Link to comment
Share on other sites

  • 0

Hi there,

 

You're correct, I am attempting to connect to the DB with a database user I've created in Plesk.

 

I've tried creating a new user with a simpler password and using that, but I don't think I've tried changing the password of the other user I was using. I'm using a half-simple-half-complex password, it's random numbers and letters but no odd ascii characters. It's worth a shot though.

 

Unfortunately it's not even using Apache, I'm using IIS (windows box). But I will install phpMyAdmin in my WHMCS directory to see if I can access the DB from there.

 

Thanks for the tips, I'll report back with what happens.

Link to comment
Share on other sites

  • 0

Okay, I'm reporting back that I installed phpMyAdmin in the WHMCS directory, set it up with the same user as WHMCS, and was able to access the DB that I want WHMCS to access without a problem.

 

I've also changed the password on the DB user to a simple word, and it still didn't work.

 

Any other ideas?

Link to comment
Share on other sites

  • 0
Hi guys,

 

Thanks for sticking with me. This may seem silly but how do I check if innoDB is enabled?

 

Hey,

 

Edit your my.cnf file (should be in /etc/my.cnf) and add this line. If not use the locate my.cnf in SSH.

 

#skip-innodb

 

Save and Restart MySQL.

 

From,

Adam

Link to comment
Share on other sites

  • 0
What good does it do to add a commented line?

#skip-innodb

 

This will enable innodb databases for MySQL.

I don't profess to know much about mySQL, but what you posted is a commented line. ("#" means to ignore what follows on the same line). This will not enable innodb, as far as I know. From the mySQL docs:

From MySQL 4.0 on, the InnoDB storage engine is enabled by default. If you don't want to use InnoDB tables, you can add the skip-innodb option to your MySQL option file.

 

Can you point me to the docs that say adding the commented line alone will actually enable it?

Link to comment
Share on other sites

  • 0

Hey,

 

NOTE: skip-innodb option will be added in my.cnf file to disable InnoDB tables. To use InnoDB again - just comment skip-innodb option before you start the server and configure datafiles for InnoDB tables. In my.cnf default configuration for InnoDB tables is provided.

 

I have this running on my server, MySQL v4.1.22 which has it enabled when its commented out.

 

From,

Adam

Link to comment
Share on other sites

  • 0

Ah, that explains it. Adding the commented line will not enable it, commenting the line if it exists will enable innodb again if it was enabled in the first place.

IE:

skip-innodb (when this exists in the cnf file, innodb is disabled)

#skip-innodb (adding # disables the "skip", allowing innodb again)

Link to comment
Share on other sites

  • 0
Ah, that explains it. Adding the commented line will not enable it, commenting the line if it exists will enable innodb again if it was enabled in the first place.

IE:

skip-innodb (when this exists in the cnf file, innodb is disabled)

#skip-innodb (adding # disables the "skip", allowing innodb again)

 

Correct! I was confused when I first read it :)

 

But again, I'm not sure if WHMCS uses Innodb, but if it does, this would solve the problem. So l0gic, if it doesn't work go open up a support ticket with WHMCS,

http://support.whmcs.com/submitticket.php

 

 

From,

Adam

Link to comment
Share on other sites

  • 0

Hi Adam & Folks,

 

I was trying to figure out which my.ini to add the #skip-innodb to (because I'm on Windows and Plesk has all these template my.ini files) when I came across a way to display the settings in use on my MySQL installation, and sure enough... InnoDB displays TRUE. So I assume it's already running. Unfortunately that doesn't help my situation because we were hoping that InnoDB would solve the issue or at least clarify it.

 

Where to now, boys?

 

I've also tried specifying my admin mysql account for WHMCS to access its database but that didn't even work. This leads me to believe (quite strongly) that it's not a user/password issue. I've double and triple-checked the name of the database, and ironically the error I'm getting doesn't change if I change the name of the database to something else completely. Isn't that a bit odd? Or perhaps it's not even getting to that stage?

Link to comment
Share on other sites

  • 0

WHMCS uses MyISAM tables and hence should be using the MyISAM engine ... not innodb.

 

If your db is set to innodb by default or myisam is totally disabled you need to change it in the conf file here.

 

If you need help, post the contents of your my.conf

Link to comment
Share on other sites

  • 0

Aha, thanks Trine!

 

Okay, I'll post my my.ini now, considering I really don't know how to enable MyISAM. ;)

 

# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory 
# of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To
# make sure the server reads the config file use the startup option 
# "--defaults-file". 
#
# To run run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
# command line shell, e.g.
# mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQL41
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

default-character-set=latin1


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="c:/Program Files/SWsoft/Plesk/Databases/MySQL/"

#Path to the database root
datadir="c:/Program Files/SWsoft/Plesk/Databases/MySQL/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=0

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=52M


# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before.  This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8

#*** MyISAM Specific options

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method.  This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method.  This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=103M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=85M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=256K


#*** INNODB Specific options ***


# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata
# information.  If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS.  As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=3465K

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=2M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system.  Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=165M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=10M

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8

Link to comment
Share on other sites

  • 0

no problemo!

 

actually, the default install would have installed the MyISAM engine. ;)

 

on a windoze box, you normally have:

 

WINDOWSDIRECTORY\my.ini

C:\my.cnf

INSTALLDIRECTORY\my.ini

 

Mysql reads all three.

Link to comment
Share on other sites

  • 0

try changing

default-storage-engine=INNODB

to

default-storage-engine=MyISAM

 

BUT STOP ! if you already have a few tables, and dbs, make sure you dump them, and convert them to MyISAM. Short of that, you may want to reinstall as MyISAM. Just make sure you have a backup.

Link to comment
Share on other sites

  • 0

I've read somewhere that it's possible to change a databases storage engine on the fly, is that true? And if so, could I not just create the database with phpmyadmin or something and choose to use MyISAM?

Link to comment
Share on other sites

  • 0

I'm not sure that that is the problem though - when accessing the DB using phpMyAdmin what storage engine does it say the WHMCS db is using?

 

IMHO if you can access the DB using phpMyAdmin installed in the WHMCS directory then you should be able to access it with WHMCS

 

is phpMyAdmin accessing the DB via socket or tcp port?

Link to comment
Share on other sites

  • 0

Hi nitro,

 

Thanks for your help. phpMyAdmin is accessing it via socket as far as I know (I think it defaults to that if you only specify the bare minimum of essential information for its configuration.)

Link to comment
Share on other sites

  • 0

ah - can you force to connect via TCP in the phpMyAdmin config and see if you can connect? I'm not sure about WHMCS but I am guessing it would be accessing via TCP/IP seeing as the DB setup at installation does not mention anything about sockets.

 

what happens if you try:

 

telnet localhost 3306

 

in a command window on your windows server - it should connect. if you get connection refused or no response then you will need to check your MySQL / windows firewall / etc. setup.

Link to comment
Share on other sites

  • 0

Hi nitro,

 

Thanks again. I tested out telnetting locally on that port and it connected. I got a bunch of random ASCII characters (along with a version number, I think) but it was successful.

 

(Also, just for fun I telnetted to my box on that port from another machine and it also connected.)

 

What does this tell us?

Link to comment
Share on other sites

  • 0
try changing

default-storage-engine=INNODB

to

default-storage-engine=MyISAM

 

BUT STOP ! if you already have a few tables, and dbs, make sure you dump them, and convert them to MyISAM. Short of that, you may want to reinstall as MyISAM. Just make sure you have a backup.

 

Hi Trine,

 

I just wanted to follow up that phpMyAdmin said that MyISAM was available on my server, so I assume that's not the problem after all. Thanks though, I'm up for trying anything at this point.

Link to comment
Share on other sites

  • 0

Hey,

 

I thought you were on Linux, that would explain a lot.

 

Um, after you save any setting in the my.ini file you need to restart MySQL.

 

From the command prompt you should

 

mysql -u root -p shutdown

 

then

 

net start mysql

 

From,

Adam

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated