Renaming a database in cPanel - database

Is there a way to rename database name in cPanel so the prefix with account name is dropped?
I tried to use Restore feature to upload a database from another server, but it added a suffix with account name, making it account_dbname. I just need it to be dbname.
Tried using MyPHP admin feature but it still keeps adding sufix when new name is given.
Thanks

If you are talking about MySQl database, go to phpmyadmin > select the database from the left sidebar , once inside the database, click operations >> Rename Databsase

For cPanel: If you want the same database user to have access to the renamed database, you should take note of the username already assigned to the database, which may or may not be similar to the name of the current database
In cPanel, click on MySQL Databases.
Scroll down to the Current Databases section of the page.
Find the database you are about to rename, and take note or remember the database user already assigned to the database. You will need to know this for step 2.
You can return to the cPanel home screen to begin Step 1.
Step 1: Renaming the Database
From cPanel, click on phpMyAdmin. (It should open in a new tab.)
Click on the database you wish to rename in the left hand column.
Click on the Operations tab.
Where it says "Rename database to:" enter the new database name.
Click the Go button.
When it asks you to want to create the new database and drop the old database, click OK to proceed. (This is a good time to make sure you spelled the new name correctly.)
Once the operation is complete, click OK when asked if you want to reload the database.
Step 2: Reconfiguring User Permissions
If your hosting plan has cPanel, then you will need to reconfigure user permissions.
Go back to the main cPanel page.
Click on MySQL Databases.
Scroll down to the Add User To Database section of the page.
Select the database from the list (should be the new name).
Select the database user from the list (the same one that used to be associated with this database).
Click on Add button.
On the Manage User Privileges page that appears, check the box next to All Privileges.
Click on the Make Changes button.
Step 3: Update Scripts
You may need to update any scripts or applications that reference this database, since the name has changed, if you want them to continue to have access to this database.

Related

Remove all SQL users from a DB

I have a database that I am migrating, but when I do the restore all the users of that database are also migrated.
Is there any way to do a restore of the DB only of the data? Without the users/roles
Or any way to remove all users from the DB?
(This users i want to remove)
In total there are 15BBDD with +50 users.
In Management Studio, you can right click on your database, select Tasks then Generate Scripts...
On Choose Objects screen choose users you want to remove, or all.
On Set scripting options page, go to Advanced, find Script DROP and CREATE and choose option to only Script DROP
Select option to open in a new query window.
Next, next, finish and you'll have your script to drop all users.

Is it possible to kick users out of a stand alone Access database that is housed in a shared folder?

I built an Access DB and placed it in a shared folder where users are to copy and paste directly to their desktops. There are some that are accessing the database directly from the folder; hence locking the database up for any updates to be made.
There are no log in or user credentials used when accessing the database so I can't place any kind of audit trail on it to determine the users that continue to open the database directly from the folder.
Is it possible to close the database; knocking out these individuals that continue to lock it up? Or is it possible to place some sort of an audit trail in the database to capture user data that would identify the individual; i.e. computer address, computer name, etc.
You should leave that setup and arrange for each user to always have their own copy of the frontend - having tables linked from one backend, if they need that.
A script and a shortcut is used for that. It is described in detail in my article:
Deploy and update a Microsoft Access application with one click
(if you don't have an account, browse for the link: Read the full article)

how to create new MSSQL user with all privilegs only to ONE database

I've been trying to figure out how to add a new user,
but I haven't managed to figure it out so the new user will have access to only a specific database without being able to see the whole server / users / databases.
Any help will be apperciated
thank you!
To add a new user who have access to only 1 database, you need to create a new login and add a user mapping to that login for the database you want,
to do this, open MSSQL Management Studio, on the left panel, expand your server by click on the checkbox and select security then Logins.
Then, right click on the logins box and select new login.
On the new login window, provide login name(user name) and authentication type, then there's select page tab on the left side, then select user mapping and add the database you want to that user, also remember to add object to default schema of that database.
USE Databasename ;
CREATE USER username WITH PASSWORD='passwd';
GRANT ALL ON Databasename TO username;
If you are on SQL Server 2012 and higher, Contained Databases is what you are looking for.
Making a database contained, you give it the ability to authenticate a user (not login), and the users of contained database will see nothing at the server level, no other databases will be visible to them.

Grey out 'Edit Top 200 Rows' SSMS

In SQL Server MNGT Studio 2012, we have a database that we only want to grant a specific user read-only access.
So me (being an admin), login into the server.. for arguments sake, the database name is SQLSERVER01
Then once logged in I see Databases, Security, Server Objects, Replication, Management, and SQL Server Agent. I go into the Security tab and go to Logins. The user that we want to give read-only access to already has a login. So I double click on their login. I go to User Mapping. Find the database that I want to give them read-only access to. I click the checkbox next to the database name, and below I give the user db_datareader and public.
So, I call the user and they're able to see the tables within the database, but if they were to right-click on a table name, they can still see the option that says Edit Top 200 Rows, and click it and see the editing gui for that table. Now I didn't test out entering data to see if they could actually edit or add data, because it's too risky.
So my question is, did I give this user the right access? If so, how do I grey out the option to 'Edit Top 200 Rows'? If not, what do I need to do?
Any help is appreciated.
SSMS does not query permissions to determine a user's capabilities or UI options. For example, you may not have DDL modification privileges, but it will let you attempt to script alter/create statements. You can't take away the edit rows option, but if they don't have the permission then the commit will fail when they try to move focus off the row they have edited.
If you want to see the effective permission you can use this function to view the resulting layers of grant/denies:
https://learn.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-my-permissions-transact-sql
Generally, make sure the user's login has minimal permissions, then use roles at the DB level that have been previously reviewed/tested.

How do I design a Login page for multiple databases in VB.NET

I am working on a company project, in which it contains a data processing system and this system was previously written separately for each bank and have their own project file, and each of the project has their own database that store the user credentials for them to login using their id and password.
Now we need to merge all the projects together so that it only login via a single login page, but i am wondering how am i going to do this because the data, especially the login credentials is stored in different databases. How should I pass data from a database to another database to perform validation?
Assuming these are SQL server logins, You will probably have to build a database with an availableDB table listing the available databases. Let the user choose a database, then try to open that database using the specified credentials, kicking him/her back to the choose-a-database point in the application.
If that doesn't answer your question, we'll need a little more information: architecture, desired interface, etc.
Hope this helps.
Why Dont You Use a drop down on login form with Every bank name listed in Drop Down. After selection of bank, use if and else statements to populate selected bank database.

Resources