I would like to create a view in Drupal to list civicrm contact details.
We need to copy code from Administer->system settings->CMS database Integration paste it in sites/default/settings.php.. I did so the way it was suggested. I am getting the following error.
SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'drupaluser'#'localhost' for table 'civicrm_contact'
I can't tell for sure without seeing your settings.php, but it sounds like the user for the Drupal database "drupaluser#localhost" doesn't have permissions over your CiviCRM database. Grant that permission in MySQL, and you ought to be set.
Related
The problem is our user cannot be granted permission to VIEW ANY DATABASE, nor CREATE DATABASE. So we've setup an account that is db_owner of the database and created blank database to fill.
Tested locally, above works only when we GRANT user to VIEW ANY DATABASE so won't apply in our target environment. My assumption was that EF is trying to establish whether database is already there, but since it cannot see any it'll always try to create one. Is there any way around it? Ideally - is there a setting that will tell EF that DB is there and there's no need to look for it?
This is a bug in EF6. The code makes the incorrect assumption that db_id('dbname') works without VIEW ANY DATABASE. It only works if the login running the query is the database owner. Not a mere member of the DB_OWNER fixed database role. I've reported it, and suggesed an improvement. But I'm not sure it will get fixed.
As a workaround just make the app user the real database owner. That won't prevent sysadmins from connecting as dbo. eg
alter authorization on database::AppDatabase to Appuser
You'll have to drop the database user before making the login the owner.
I was trying to update one of the data source of my forena configuration. I first update the uri address. After I clicked Updated the forena module broke. I'm sure the problem is that one of the Data Source (the one I updated) can't connect to the database because I didn't update the password. But now, eveytime I click in Configure in my Data source I get the following error:
Fatal error: Call to a member function setAttribute() on a non-object
in
/opt/bitnami/apps/drupal/htdocs/sites/all/modules/forena/plugins/FrxPDO.inc
on line 63
Becuase of this error I can't correct the password.
The drupal log shows the following:
SQLSTATE[HY000] [1045] Access denied for user
'bitnami'#'54.204.20.212' (using password: YES)
I'm thinking there most be a config file somewhere in the htdocs directory but I can't find it.
Can somebody guide on how to fix this?
Thanks,
Claudia
Bitnami developer here,
It seems that bitnami user is trying to access to the dtabase. By default, bitnami user has not privileges to access to the drupal database.
Check in installdir/apps/drupal/htdocs/sites/default/settings.php
the user and the password of the drupal database. You could try execute the action with these parameters. By default, your database name should be bitnami_drupal, and your user bn_drupal.
You also can change the privileges for bitnami user:
$ /installdir/mysql/bin/mysql -u root -p
grant all privileges on bitnami_drupal.* TO 'bitnami'#'localhost' identified by 'not_easy_password'
If you want to create a new database, please follow this link:
https://wiki.bitnami.com/Components/MySQL#How_to_create_a_database_for_a_custom_application.3f
I hope it helps
David
While trying to do anything related to deploying to Azure/creating a BACPAC in SSMS 2012 I encounter error for each of 3 users in my database (who are not the user that is currently logged on)
Validation of the schema model for data package failed. Error
SQL71501: Error validating element [VARIABLE_USER_NAME_HERE]: User:
[VARIABLE_USER_NAME_HERE] has an unresolved reference to Login
[VARIABLE_USER_NAME_HERE]. (Microsoft.SqlServer.Dac)
Any clues?
This SO question really helped:
Can I ignore logins when publishing a Visual Studio Database project?
I realised that the user I was logged on (to my local database) with, had no permissions to view the login details for the login associated with the peer users that were being complained about in the error message. Written in more plain English, and assuming that there are just 2 database users (mr_spoon and mr_fork), what the error message means is "The currently logged on user [mr_spoon] can see that there is another user called "mr_fork" but cannot view the details of the login [also called "mr_fork" in this case] associated with that user"
Logging onto the master DB with my Windows admin login, and then running this query solved it:
GRANT VIEW DEFINITION ON LOGIN::the_login_name_in_the_error_message TO the_user_i_logged_on_with_and_ran_the_export_from
i.e. admin should run this:
GRANT VIEW DEFINITION ON LOGIN::mr_fork TO mr_spoon
Note that SQL Server permission system supports the notion of both Users and Logins, so I've hopefully been quite careful to say user when I mean user and login where I mean login. Why not just run the export from the admin login you may ask? The machine that can do that doesn't have SSMS2012 nor is it possible to install it, and it's the only machine the admin login works from.. Thus, I'd expect this problem is rare but maybe one day this will help someone
I thought I'd post a Q&A because everywhere I looked I only found reference to SQL71501 within the context of SSDT, not SSMS2012/Azure Deployment
I'm looking at the Database Project in VS2010, the idea being that I want something I can use to keep track of the database schema (in source control) and the ability to generate "new install" scripts, and change scripts.
When I create a new database project wizard and import my existing database schema, it won't "build". I get the error:
SQL03006: User: [scanner] has an
unresolved reference to Login
[scanner].
The SQL that generates this error:
CREATE USER [scanner] FOR LOGIN
[scanner];
The user "scanner" is a login defined in the database I imported. I have no idea what it's teling me, and google isn't throwing much up. Any ideas?
The Login is actually defined in the master database of the server install. The CREATE USER statement needs to point at an existing Login otherwise it errors. The Database Project is not aware of the Login at the server level. Either you can create a Server Project to handle the Logins, or you can turn off the checking of Security objects in your Database Project. See the answer by Demetri M for more details: http://social.msdn.microsoft.com/Forums/eu/vstsdb/thread/1f8226fe-b791-4344-8735-3d38307e8664
I'm using Visual Studio 2012 for a SQL Server 2008 R2 database project. The options listed by #Judah don't appear to work anymore.
They now appear to be Settings that you configure while doing a Schema Compare:
Right click database project >
Choose 'Schema Compare' >
Choose the 'Settings' gear icon >
Choose the 'Object Types' tab >
Logins are Non-Application-scoped. Database roles, Permissions, Role Memberships, and Users are all Application-scoped.
Unfortunately, the only way that I can find to preserve these is to save the schema compare. This can be a little inconvenient if you're sharing this on a team and would like project/database (or server) settings for any schema compare.
It gets the job done, though.
You can change the create user scripts to create roles.
So instead of "Create user userName for login loginName;"
use "Create Role [userName] authorization dbo;"
This is a hack, but as long as you aren't having to deal with users and roles in your project, you can happily do the following:
GRANT EXECUTE
ON OBJECT::[dbo].[sp_name] TO [userName];
Apparently, this issue is still occurring on VS2017 database projects as well.
I've managed to solve it by first creating the login and then create the user.
-- Windows Account
CREATE LOGIN [Domain\Username]
FROM WINDOWS WITH DEFAULT_LANGUAGE = [us_english];
GO
CREATE USER [Domain\Username] FOR LOGIN [Domain\Username];
GO
-- Sql Acccount
CREATE LOGIN [sql_account] WITH PASSWORD = 'Ch#ngeth1spA$swurD'
GO
CREATE USER [sql_account]
FROM LOGIN [sql_account]
WITH DEFAULT_SCHEMA = dbo
GO
-- Then set the sql file Build Action to "Build"
In the database project open the 'Security' folder (assuming that's how your database was imported). For each user profile that is causing an issue, set the build action to 'None' in the properties panel. You will also have to remove them from any other files in which they appear, including Permissions.sql and RoleMemberships.sql.
Note: This is a community wiki entry and is mainly to document a problem together with its solution. I was hardly able to find information on the net to solve this. Hope it helps someone!
I have a SQL-Server 2005 DB with the data tables being on the dbo schema.
For a new component on the project, I created a new data access layer (using NHibernate) and to nicely capsule this, I created a new schema.
For all the objects I needed, I created a View:
myschema.ViewTable1
myschema.ViewTable2
etc.
And granted select permission.
Now, when I tried to access these views by a user that only had select permissions on the views but not the underlying table with NHibernate, I got:
The SELECT permission was denied on the object 'dbo.Table1', database 'TestDB', schema 'dbo'.
According all the documentation, this should be possible.
Even more strangely, the SQL did work executed in Management Studio as a plain select.
But if I executed it with exec sp_executesql as NHibernate does it, it broke with the same exception.
After a long time searching I finally found this question here on StackOverflow.
The added Update gave the clue:
My new schema myschema was owned by my windows user and not by the dbo!
After changing the schema owner to dbo and recreation of all the myschema objects (Yes, this is required!) things start to work as expected!
Hope this helps someone.
Solution:
Make sure your schemas are owned by the same role!