Every time I create a database using a custom joomla template quick install the database is created but does not show up in MySQL Database management despite the fact that it most definitely does exist and MySQL database management knows it does because it wont let me create a database with that name due to error "Database already exists".
I want to delete joomlasall database.
Full size image
http://img99.imageshack.us/img99/4995/tempkh.png
If you can not see database but you are sure that it exists, this is definitely permissions issue.
Do
SHOW GRANTS
More info here
You will see that you does not hold global SELECT privilege.
You need to explicitly GRANT permissions with similar command like:
GRANT ALL PRIVILEGES ON DBNAME.* TO 'username'#'localhost';
Instead of ALL you can specify SELECT, INSERT, UPDATE, DELETE , EXECUTE, etc... check this
replace DBNAME with your DB name, username with user for whom you want to grant access and localhost with hostname if DB is used remotly.
To do this, you need GRANT privilege or to be root user.
use same mysql user credentials for Joomla DB connectivity also the one you are using in phpmyadmin.
Related
Is there a way to restrict users from accessing a particular database/schema within MySQL?
I want to create a database/schema that only I can access.
I also want to change the password of the "mysql" user but I do not see this user in the mysql.user table even though I was able to use this user to login to mysql.
I tried changing the password of the user by executing the statement -
mysqladmin --user=mysql --password=oldpassword password "newpassword".
But now I am not able to login this user altogether. I've tried both the old and the new passwords.
I am wondering if my changing this password can impact any mysql service running on the system.
For restricting table and schema you can use the GRANT, you can set permission for each user or group on a particular tables for more details :
Tutorial on Grant for mysql
For your access the answer is already on stackoverflow :How do I retrieve my MySQL username and password?
Hope that can help you
I create a MySQL database on Azure with a "Mercury" princing level, I log myself in MySQL Workbench, but I can't add an user or change privileges with "GRANT ALL PRIVILEGES ON ... " I get "Access denied for user x". (I logged with the username and password that Azure give me).
Any idea ?
Some Cloud Mysql restrict user's privileges just like alisql. You even can not access the mysql.user table.
You can just use the account which is created in web page and create users in web page. The account you used has not super privilege. So you can not execute "GRANT ALL PRIVILEGES ON ... " to create super privilege account.
If you want to get super privileges, you can try as follows:
Buy the azure host and install mysql yourself
Ask azure supportwhether you can have root account
Change another cloud mysql which has root privileges like 'UCloud'
This is not a problem with root privileges, this functionality is not available for this specific database provider. The default MySQL database provider in Azure for now is ClearDB, and I'm afraid you are not able to create more users for the database:
Can I create additional users for my ClearDB MySQL database cluster solution?
No. You cannot create additional users but you can create additional databases on your ClearDB database cluster
I want to see the names of all the users for MySQL. When I try to google this question most results are all concerned with users in a database as opposed to MySQL users. I checked out the MySQL documentation but it is very verbose and does not really help much. How do I view the account names of MySQL users, change permissions, and create new users?
Normally very simple... Log in as root, and do:
select * from mysql.user;
And if you googled on mysql show users you would have gotten this as first hit.
Furthermore, rights to specific databases are held in mysql.db and host limitations are in mysql.host
Display only User and Host
SELECT User, Host FROM mysql.user
Display users and privileges (pretty way)
SELECT * FROM mysql.user\G;
Create user
CREATE USER 'jeffrey'#'localhost' IDENTIFIED BY 'mypass';
Grant Privileges (Set)
-- Grant all privileges - Specific Database, all tables
GRANT ALL ON db1.* TO 'jeffrey'#'localhost';
-- Grant only SELECT privilege - Specific Database, specific table
GRANT SELECT ON db2.invoice TO 'jeffrey'#'localhost';
-- Grant USAGE privilege All databases, all tables
GRANT USAGE ON *.* TO 'jeffrey'#'localhost' WITH MAX_QUERIES_PER_HOUR 90;
List Of Privileges:
CREATE
DROP
GRANT OPTION
LOCK TABLES
REFERENCES
EVENT
ALTER
DELETE
INDEX
INSERT
SELECT
UPDATE
CREATE TEMPORARY TABLES
TRIGGER
CREATE VIEW
SHOW VIEW
ALTER ROUTINE
CREATE ROUTINE
EXECUTE
FILE
CREATE USER
PROCESS
RELOAD
REPLICATION CLIENT
REPLICATION SLAVE
SHOW DATABASES
SHUTDOWN
SUPER
ALL [PRIVILEGES]
USAGE
Performing the following query will provide all your MySQL users:
SELECT user FROM mysql.user;
You may need to login as admin to perform the above query. If that is the case login as admin from terminal by using the following command:
sudo mysql -p
Additionally, you can also create new users as follows:
create user '<user name>'#'<host name>';
Example
create user 'tony'#'localhost';
Depending on the scope of your project you will need to provide this new user with various permissions. To do that use the following syntax:
grant <permission type> on <database name> to '<user name>'#'<host name>';
Example
grant all on uncovery.* to 'tony'#'localhost';
If you are looking to do this with a GUI just to get yourself started with MySQL download MySQL workbench.
https://www.mysql.com/products/workbench/
Once this is completed launch the application and add your new connection by clicking the little + sign and filling out the parameters.
Defaults:
Hostname: 127.0.0.1 (if hosted on the machine you are running Workbench)
Username: root
Password: <blank> (if you set the root password enter that here)
Click test connection and make changes until the connection is successful and connect.
You can then click the server drop-down on the top and select Users and Privileges. This will give you a nice easy GUI to play around with things and get familiar with the available options.
Some additional documentation can be found here:
https://dev.mysql.com/doc/workbench/en/wb-mysql-connections-navigator-management-users-and-privileges.html
I have a MySQL database which is hosted in Azure, and I'm accessing it through MySQL Workbench in my laptop. The point is that when I want to execute some commands I get error message saying I don't have enough privileges. I tried to access the Users and Privileges section in MySQL Workbench, but I got the message saying:
The account you are currently using does not have sufficient
privileges to make changes to MySQL users and privileges.
Where can I give superuser privileges, so that I can execute every command from my MySQL Workbench?
The privileges is only related to the user, the client you use has
nothing to do with it, so whether you use a workbench or a CLI, it
does not matter.
In MySQL privileges are arranged to different "user", and "user" are composed by "username" and "host" (from where you login the mysql), so basically, a user in mysql who own specific privilege looks like:
'foo'#'192.16.22.231', 'bar'#'10.3.243.%' ..
How to improve all the privileges to a specific user? do this as a super user:
GRANT ALL PRIVILEGES ON \*.* TO YOUR_USER
super user is usually 'root'#'127.0.0.1', since you have to grant to your specific 'user', you have to know the IP address from which you login
If you think above is a little complicated and your mysql is just fast-installed and simple configured, you can just try this and maybe it helps:
login as 'root' or mysql
execute this:
GRANT ALL PRIVILEGES ON \*.* TO 'your_user'#'%';
Execute SELECT * FROM mysql.user WHERE user = 'your account'\G in your client. If All the priv column is 'Y', your account has superuser privileges.
You can also try UPDATE mysql.user. Then, execute flush privileges; to make your changes effective.
Execute GRANT ALL PRIVILEGES ON \*.* TO 'your_user'#'%'; to add a new superuser privilege account.
If all the above operations are not allowed, please call the Azure support. In cloud database, some system databases may be not be allowed to access.
I had solved this issue by doing:
UPDATE mysql.user SET Grant_priv = 'Y' WHERE User = 'root';
This can be "dangerous" if you do not know what are you doing ;-)
Is it possible to have database level credentials for MySQL?
In our current system we have multiple databases in one database server, if we connect to the server using any tool we can see all databases in that server, to have more secure system.
Can we have credentials for each database.
You can't have credentials for databases. But you can have credentials for created users and grant/restrict access to any tables/databases according your policy.
create user
grant
priviledges
Yes, absolutely, you can set up access privileges on per-database basis. In fact, MySQL allows very fine-grained privileges down to table and even column level. E.g.:
-- Creates a user
GRANT USAGE ON *.* TO 'username'#'hostname' IDENTIFIED BY PASSWORD '*SOMEPASSWORD';
-- Gives the user access to a single database `database_name`
GRANT SELECT, INSERT, UPDATE, DELETE ON `database_name`.* TO 'username'#'hostname';
You probably want to read more about GRANT syntax and MySQL privileges.
Worth adding, that you are allowed to have usernames identical to database names.