I know this is a duplicate question however whatever I tried, unfortunately no luck. (To add, I am using MAMP)
I believe I successfully setup the database connection because, using the registration form (Auth/register), after submitting the form, I was getting the error PDO Exception: Driver not found before, but after changing to my MAMP to PHP 5.5.17 from the default(PHP 5.6.1), I started getting error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.users' doesn't exist, which I believe shows that the database connection is working and it's just the 'users table' is not created.
Here starts my problem. When I try to use php artisan migrate or migrate:{anything} in the terminal, it's throwing the error:
[PDOException]
could not find driver
But what I want to do is to use php artisan migrate to be able to create tables and migrate them.
Things I have tried:
I added <?php echo phpinfo(); ?> to if pdo files are successfully installed.
I get the result:
so I think it seems okay.
People were talking about opening /MAMP/bin/php/php5.6.1/conf/php.ini and adding extension=pdo_mysql.so in the code, but I have mine already placed there.
When I try php -i | grep PDO in the project root (/MAMP/htdocs/proj), I got:
PDO
PDO support => enabled
PDO drivers => sqlite
PDO Driver for SQLite 3.x => enabled
php -i | grep Conf and `php --ini also outputs:
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.1/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.1/conf/php.ini but php artisan migrate still throwing the same error
SOLUTION:
I chose MAMP to use version 5.5.17 instead of 5.6.1 in the browser (from MAMP Preferences), however this time terminal was running the 5.6.1. What I did was first checking which PHP command and then, running the nano ~/.bash_profile command; and editing the version document. Now everything is up and running :)
What you see in the browser is that you have PDO enabled for PHP running through apache. But this does not mean you have it enabled for PHP running through CLI (in fact they are using two separate ini files). To confirm that you can try:
php -i | grep PDO
And you will see it is missing or not enabled. So what you need to do is to find which php.ini is using the PHP running through CLI and add the PDO module there:
php -i | grep Conf
It will output something like:
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Related
While upgrading ETL scripts for Mysql 5.8 to MySQL8 upgrade, as soon as I have updated the data-integration/lib jar to mysql-connector-java-8.0.xx.jar, it has started blowing with following error.
Driver class 'org.gjt.mm.mysql.Driver' could not be found, make sure the 'MySQL' driver (jar file) is installed.
Could you please try to add both jars in
data-integration/lib
As I did, I have added the lastest jar of 5.x i.e mysql-connector-java-5.1.48.jarand the same version mine is 8.0.19 so i have added mysql-connector-java-8.0.19.jar i copied into location data-integration/lib .
After the test its working fine now.
I did spent lot of time debugging and finally concluded, two things, I hope this may save others time in similar situation.
Reason: There is hardcoded jdbc drive name in org.pentaho.di.core.database.MySQLDatabaseMeta, and it always returns org.gjt.mm.mysql.Driver which is removed and new Driver with name com.mysql.jdbc.Driver or com.mysql.cj.jdbc.Driver should be used.
Solutions Any of below should be done to resolve.
Continue using the old jdbc jar.
Modify the org.pentaho.di.core.database.MySQLDatabaseMeta below method, compile and place it in classes directory.
public String getDriverClass() {
if (getAccessType()==DatabaseMeta.TYPE_ACCESS_ODBC)
{
return "sun.jdbc.odbc.JdbcOdbcDriver";
}
else
{
return "com.mysql.cj.jdbc.Driver";
} }
Use the Generic database connection, then you can specify the driver class yourself. (Based on #Cyrus comment.)
Pentaho open bug reference.
I was working with pdi 9.1, all I did to get rid of this error was to copy these two jar files in the data-integration\lib:
mysql-connector-java-5.1.49.jar
mysql-connector-java-5.1.49-bin.jar
The link to the zip folder is mentioned in the above comments
Restart your spoon!
And that's it.
i just to use Pentaho version 9.1 - 9.1.0.0-324 and mysql-connector-java-8.0.25
1- Make sure the Pentaho is not running.
2- Download the mysql connector at the link below.(https://mvnrepository.com/artifact/mysql/mysql-connector-java)
3- Copy the .jar file (mysql-connector-java-8.0.25.jar) and paste it in your Lib folder:
Example: C:....\pentaho-data-integration\lib
4- Execute Pentaho (Spoon.bat)
MySQL driver for version 8 changed the class name. Therefore, you must set it as a Generic connection instead, and use com.mysql.jdbc.Driver as the class.
I have fixed the issue by replacing mysql-connector-java-5.1.42-bin.jar with mysql-connector-java-5.1.44.jar
Reference
I am using Pentaho 9.1.0.0-324 and had the same problem. I downloaded the Everything app and through it I found that I have already a file named mysql-connector-j-8.0.31.jar at C:\Program Files (x86)\MySQL\Connector J 8.0\ folder. I simply copied the file into C:\Pentaho\lib and the problem solved. However, now I am getting another error as below:
Connection failed. Verify all connection parameters and confirm that
the appropriate driver is installed. Access denied for user
'root'#'localhost' (using password: YES)
Update
I solved the Access denied error by reinstalling MySQL with legacy password option along with a password without non-alphabetical symbols.
Does the MySQL-server and PHP5-MySQLi version have to match in order for a connection to be possible? I'm currently receiving the error below: I am running BSD.
"Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'..."
Here is the the connection info:
$info = "mysql:dbname=myDB;host=localhost";
$user = "dbUser";
$pw = "somePW";
return(new PDO($info, $user, $pw));
Here is my MySQL information:
mysql-server-5.5.24
php5-mysqli-5.4.3
I had this same issue on my CentOS install. I had tried to install imagick and hosed my install. When I removed all of my php files and reinstalled something wasn't working right.
I ran:
yum install php-pdo
yum install php-pdo_mysql
After doing those two lines I ran
service httpd restart
and everything came back up and running.
PDO uses database specific drivers to connect to database systems. It looks like you are missing the pdo_mysql driver that is required to connect to a MySQL database. There is some details on installing the driver on the pdo_mysql manual page, or there may be a BSD package that you can use (I am afraid I'm not familiar enough with BSD to offer specific advice).
Thanks to zerkms and John C for pointing me in the right direction. Below are the commands I used to install the driver:
#cd /usr/ports/databases/php5-pdo_mysql
#make install clean
#apachectl restart
I can't get the propel script running on my system.
My build.properties looks like this:
propel.project = test
# The Propel driver to use for generating SQL, etc.
propel.database = pgsql
# This must be a PDO DSN
propel.database.url = pgsql:host=localhost;port=5432;dbname=test
propel.database.user = user
propel.database.password = password
I get the following error when I run propel-gen . reverse:
[propel-schema-reverse] There was an error building XML from metadata:
/home/user/web/dev/vendor/propel/generator/build-propel.xml:296:1:
could not find driver
pdo_pgsql is enabled (there are several applications running it succesfully); but in my phpinfo there seems to be a wrong version stated:
PostgreSQL(libpq) Version 8.4.13
I'm running PostgreSQL 9.1. I think this causes the error but I have no idea why the versions are different. I have installed first PostGreSQL and then php5-fpm etc. via apt-get.
Using Php 5.3.5 on Ubuntu 11.04. Can somebody help?
Remove all empty spaces and newlines in between the xml tags in the buildtime-conf.xml. That worked for me.
My file looked like this after using the runtime-conf.xml as a template for the buildtime-conf.xml
...
<adapter>
mysql
</adapter>
...
Now it looks like that and it works
...
<adapter>mysql</adapter>
...
I'm trying to run my jruby application on trinidad.
Following the readme, I included the trinidad gem in the gemfile and ran
rails server -e production -p 80 -d trinidad
When I access my server with a browser, it gives me an error message about how it can't find the correct class for my database driver, which is in lib/odbc6.jar and works fine if I run the project using WEBrick. The error message looks like this:
org.jruby.rack.RackInitializationException:
load error: /home/bdares/project/config/environment
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#(my_jdbc_connection_string)
What am I doing wrong?
Plz try to setup $CLASSPATH global var.
Here are few more details: https://stackoverflow.com/a/11130246/255633
So I've uncommented the the *extension=php_mysql.dll* line in the php.ini file and I've also filled in the *extension_dir* and *doc_root* but everytime I try to run a php file with the following code:
<?php
mysql_connect("localhost", "root", "admin") or die(mysql_error());
echo "Connected to MySQL<br />";
?>
I get the following error:
"Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\vhosts\guestbook\extract.php on line 3"
Does anyone know how to fix this?
Your PHP is enabled - that's what's throwing the error you are seeing.
The problem is with the PHP config. The mysql extension is not loaded.
I've uncommented the the *extension=php_mysql.dll* line
And have you checked the file exists in the specified extension dir and is readable by the webserver?
Have you checked that this is the php.ini file your webserver is using? (try running a script with just a call to phpinfo() in it).
It sounds like you have either not restarted Apache for php.ini changes to take effect, or that you do not have the PHP /ext path in your system PATH variable (or it's set wrong in php.ini).
Consider using a pre-configured and fully set up WAMP package such as:
xampp (free) -
WampDeveloper Pro (commercial) -
WampServer (free)