MariaDB + Galera, Galera does not replicate mysql.user - mariadb

I have a mariadb galera with 2 nodes, when I create an user in db1, this does not replicates en db2 but if I create a db in db1, it repplicates in db2!!!!
Any idea for mysql.user replicate?

The Galera replicate only DDL (Data definition language) and innodb-DML (Data manipulation language).
If you create a user by "insert into mysql.user ...." it is myissam-DML --> NOT REPLICATED
If you create a user by "create user ...." it is DDL --> replicated.

By default on MariaDB the database mysql and then mysql.user are MyISAM,
for change all tables on InnoDB prove this:
mysqldump -uroot -p --no-data -R --triggers mydb > mydb_schema.sql
Then dump out the data:
mysqldump -uroot -p --no-create-info -R --triggers mydb > mydb_data.sql
Change Storage Engine
sed -i.bak 's#MyISAM#innodb#g' mydb_schema.sql
and after import mydb_schema
mysql -u root -p < mydb_schema.sql
and finally the data.

Are you sure, you are creating the user with create user / grant all privileges statement?
Galera is designed to work perfectly on InnoDB, but the tables in the mysql database (like the user table) are in MyISAM what can cause stupid errors.

Related

How to encrypt root password in MariaDB?

I have three users in MariaDB namely root, testuser1, testuser2. I want to encrypt the passwords for all three users when connecting to MariaDB by typing the following command in the terminal,
1. mysql -u root -p
2. mysql -u testuser1 -p
3. mysql -u testuser2 -p
It asks for password. At this point, How can I supply encrypted password or make it read from any file which may contain it?
There is a requirement in my project to encrypt all passwords for MariaDB users. (I have also asked this question in connection with MySQL too).

mysqldump not copying all data

I have a MySQL DB that is the backend for my drupal web site, I am going through the drupal upgrade and before I do the upgrade I need to make a copy of the database.
mysqladmin create ts_prod_bak -u root --password=XXXXXX && \
mysqldump -u root --password=XXXXXX ts_prod | mysql -u root --password=XXXXXX -h localhost ts_prod_bak
This does create a new DB called ts_prod_bak and fills that DB with data from ts_prod but it isn't copying all of the data. I see some tables, cache_* that are created in the new DB but have a different size than the source. Because of this I am not confident in my backup/copy.
How can I make an exact duplicate of my source database and verify that by restoring it to another DB?

Copy a heroku postgres db to a local sqlite db

I want to copy my heroku production db (postgres) to my development (sqlite).
Copying a postgres db into another postgres db is easy using heroku pg:pull. Does anyone know how to use this command to copy postgres into sqlite?
Heroku docs on pg:pull do not say how to use different types of dbs. This old article implied that it used to be possible. Setting up a local postgres db is something I'd like to avoid.
You will need do a pg_restore locally then dump the data using the -a option to dump data only.
It should look something like this:
Download a data dump.
heroku addons:add pgbackups
heroku pgbackups:capture
curl -o latest.dump `heroku pgbackups:url`
Create a temporary database.
sudo -u postgres createdb tempdb
Restore the dump to your temporary database.
sudo -u postgres pg_restore --verbose --clean --no-acl --no-owner -h localhost -d tempdb latest.dump
Dump the data in the correct format.
sudo -u postgres pg_dump --inserts -a -b tempdb > data.sql
Read dump in sqlite3.
sqlite3
> .read data.sql
This is an approximate solution. You will most likely need to make some small adjustments.
I agree with Craig Ringer that it might be worth getting postgres running locally. Hopefully this process will do the trick though!

how to create super admin in my phpMyAdmin?

I just finished my website here I used ASP.net & MySQL.
I uploaded my website file all right.
But the problem is with my database. I create my database very will and I create all my tables but the problem is that I can't execute my stored procedure?
That is because i don't have the privileges to do this operation?
The error in phpMyAdmin is:
MySQL said:
#1227 - Access denied; you need the SUPER privilege for this operation
How can I fix this?
As MySQL root:
$ mysql -u root -p # ..or, if no password has been set..
$ mysql -u root
Run this command:
GRANT SUPER ON *.* TO user#localhost;
Further reading:
http://dev.mysql.com/doc/refman/5.1/en/grant.html

Invalid object name 'ASPState.dbo.ASPStateTempApplications' - Exception after renaming the ASPState Database

I have created new session database using the command (aspnet_regsql.exe -S -E -ssadd -sstype p) and it created DB called ASPState. Then I renamed it to something like E_ASPStateDB. I have configured the correct DB name in the sessionState connection string. But still it throws the exception Invalid object name 'ASPState.dbo.ASPStateTempApplications'
What i need to do, so that it will use the new database name?
I ran this on the db server that the site was connecting to and it solved it immediately.
USE [ASPState]
GO
DECLARE #return_value int
EXEC #return_value = [dbo].[CreateTempTables]
SELECT 'Return Value' = #return_value
GO
Since you renamed the DB you will have to regenerate the ASPnet session tables. Below is the solution to it.
To Remove, use following command: [open visual studion command prompt]
aspnet_regsql -ssremove -S [SERVER] -U [USER] -P [PWD] -d [DATABASE] -sstype c
Then add them again by following command
aspnet_regsql -ssadd -S [SERVER] -U [USER] -P [PWD] -d [DATABASE] -sstype c
You must modify the stored procedures because they invoke the tables with the database name and schema, as follows:
[ASPState].dbo.ASPStateTempApplications
you have to change it for
[E_ASPStateDB].dbo.ASPStateTempApplications
once you have registered a DB name using aspnet_regsql, you shall have to use the name you registered with. There is no point really to change the name afterwards. If you really want to use a name like E_ASPStateDB, why not delete the registration of ASPState first and then re-registering with the name E_ASPStateDB. It shall make your life easier

Resources