I'm using Vagrant to start a VirtualBox VM in windows. I do:
$ vagrant ssh
To connect to the VM. Then I do $ mysql to connect to my database. Then I can see my DB that I have created to use. However When I go to my server I see this error:
The table "doe_user" for active record class "User" cannot be found in the database.
I know thats because the database is empty and the table User doesnt exist. thats why I tried to added tables to database using this :
load all tables in the doe_db: http://***.***.**.**/install.php;
When I run this, i get:
mysql> load all tables in the doe_db: http://***.***.**.**/install.php;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'all t
ables in the doe_db: http://***.***.**.**/install.php' at line 1,
when I use show databases then I select the correct database, then asking to show the tables it returns empty set.
when I go to my http://***.***.**.**/install.php I get:
Internal Server Error
Undefined index: log
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.
Thank you.
Here is my database code:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
Now when I visit: http://***.***.**.**/index.php
I get the error:
The table "doe_user" for active record class "User" cannot be found in
the database.
However when I change my databse code to:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
And when I visit: http://***.***.**.**/index.phpI get:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
for my local host, when I want to access phpMyAdmin, I dont have any password for my root user.
You can refer MySQL - LOAD DATA INFILE to load the data from a file.
LOAD DATA INFILE 'http://***.***.**.**/install.php' INTO TABLE doe_db;
Related
I want use Yii and MS Access together, but I don't know how..
I can use ODBC without Yii like this
$link = odbc_connect($name, $user, $pass)
but now i need it in Yii, like MySQL:
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=ex1c',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'tablePrefix' => 'ex1c_',
)
what should i write in connection string
may be need something software setup in computer
how to set it?
If I'm understanding your question right, you have one set of data that you want to be able to reference from a YII application and from MS Access. The best approach I can think of here is to:
Put the data into a MySQL database
Have YII access it directly as you illustrate above
Set up the MySQL ODBC driver on the Windows machine where you are running access, and point Access at MySQL via that driver
Here is a pointer to MyODBC, which will provide the critical linkage between Access and MySQL:
http://dev.mysql.com/downloads/connector/odbc/
I am using Laravel 4.0.10 and ccovey/ldap-auth for user authentication. On the server end I have OpenLDAP server created with Turnkey OpenLDAP. I've followed the instructions but I'm getting an error when trying to connect to server.
Error:
Bind to Active Directory failed. Check the login credentials and/or server details. AD said: Invalid DN syntax
My app/config/adldap.php file:
<?php
return array(
'account_suffix' => '#mreza.vpl',
'domain_controllers' => array("ldap.vpl.lan"), // An array of domains may be provided for load balancing.
'base_dn' => 'DC=mreza,DC=vpl',
'admin_username' => 'admin',
'admin_password' => 'mypassword',
'real_primary_group' => true, // Returns the primary group (an educated guess).
'use_ssl' => false, // If TLS is true this MUST be false.
'use_tls' => false, // If SSL is true this MUST be false.
'recursive_groups' => true,
);
I added this line to app/config/auth.php:
'username' => 'uid'
My OpenLDAP database looks like this:
I want to authenticate against People group
Any ideas what I am doing wrong? I've been trying to set this up for a few days now. I am new to LDAP though.
Thanks!
Change the Admin username to either cn=Admin or cn=admin,DC=mreza,DC=vpl and try to connect. You need a full DN to bind, generally.
I have 2 sites on the same domain (example.com, site2.example.com) and I am trying to make them both reference the same user tables etc from the main site (example.com) in order to have single sign on through both.
I have 2 DBs set up - one for each - and have set up a user which can access both with all the required permissions. I have altered my settings.php in the second site as below (and numerous variations of):
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'database_site2',
'username' => 'multi_username',
'password' => 'multi_password',
'host' => 'localhost',
'prefix' => array(
'default' => 'database_site2.',
'users' => 'database_main_site.',
'sessions' => 'database_main_site.',
'role' => 'database_main_site.',
'authmap' => 'database_main_site.',
),
);
Unfortunately when then trying to access site2 after making this change, I get the following error message:
Uncaught exception thrown in shutdown function.
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in >your SQL syntax; check the manual that corresponds to your MySQL server version for the >right syntax to use near '-amalga-01.semaphore WHERE (value = >'1471293032527ac89955a330.73110726')' at line 1: DELETE FROM {semaphore} >WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => >1471293032527ac89955a330.73110726 ) in lock_release_all() (line 269 of >/home/sites/amalgamart.co.uk/public_html/exampletown/includes/lock.inc).
If someone is able to help me with this I would be forever grateful!
Thanks!
The "prefix" part of Drupal's db configuration refers to a string that is prepended to the table name within a single database, whereas you are trying to use two different databases. I don't think that this is possible in Drupal. Please read this, or you can try and see if Domain Access module could be suitable to your needs.
I am a new to yii although i have worked a lot with codeigniter and was just trying to convert my code from codeigniter to yii
But the CDbconnection is taking more than 1 second to execute i have attached a screenshot.
also the sql code i am using.
$criteria = new CDbCriteria();
$criteria->select = "total_photos";
$data = array( 'Gallerys' => Gallerynames::model()->findAll($criteria));
Please look into it
Edit:
Here is my db config
'db'=>array(
'class' => 'system.db.CDbConnection',
'connectionString' => 'mysql:host=localhost;dbname=yiiwiki',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'enableProfiling' => true,
'schemaCachingDuration' => 3600,
),
From yii guide
Because ActiveRecord relies on the metadata about tables to determine
the column information, it takes time to read the metadata and analyze
it. This may not be a problem during development stage, but for an
application running in production mode, it is a total waste of time if
the database schema does not change.
so set the schemaCachingDuration of the db application component a value greater than zero.
'db'=>array(
'class'=>'system.db.CDbConnection',
'connectionString'=>'sqlite:/wwwroot/blog/protected/data/blog.db',
'schemaCachingDuration'=>3600,
),
Keep in mind that you should specify a valid cache in the application config
EDIT
It seems your problem is not due to the schema. Refering to this changing localhost to 127.0.0.1 will fix it
I'm hosting a Yii app on shared-host with some my friend, and keep database in private MySQL server. As you knew, database info can be found so very easy in protected\config\main.php by another host owner (my friend and more):
'db'=>array(
'connectionString' => 'mysql:host=211.113.2.45;dbname=FamilyBook',
'emulatePrepare' => true,
'username' => root,
'password' => 'xcute445',
'charset' => 'utf8',
),
Is there any solution to conceal connection information as IP mySQL server, username, password?
May MySQL server provide RSA mechanism to protect database info?
Example, any people can see as below but cannot understand or use:
'db'=>array(
'connectionString' => '57bf064b2166366a5ea61109006b8d5c',
'emulatePrepare' => true,
'username' => '63a9f0ea7bb98050796b649e85481845',
'password' => 'e04ccf211208f8c97e4a36e584926e60',
'charset' => 'utf8',
), // value by MD5 function, example only
No, you cannot conceal the credentials from someone who has access to your source as long as you are using native MySql authentication. That's because your code needs to pass the credentials as cleartext¹ to the server, so it needs to be able to "decrypt" them before connecting. Someone who has access to your source can follow the same procedure and decrypt them as well.
You could secure your system by relying on some type of PAM authentication instead of user-supplied credentials, but Yii does not support such.
¹note: This is not actually true. The client passes a hash to the server, but it needs to have access to the original password in order to hash it. This means that for the purposes of this discussion it makes no difference (it would make a difference for someone who is listening on the network).
Using Yii 1.x I did it using below method.
create a class, DbConnection inside protected/components extending from CDbConnection
class DbConnection extends CDbConnection
{
public function createPdoInstance()
{
// Decrypt the password used in config file
// e.g.: $this->password = mydecrypt($this->password);
return parent::createPdoInstance();
}
}
Adjust the config file (protected/config/main.php)
'db' => array(
'class' => 'DbConnection', // Use above classname
'password' => 'encryptedpassword',
),