How to create new user and database and edit user, database ?

Note :- need to edit commands where “techouse” is mentioned.

How to change the password of existing user in mysql

ALTER USER 'techouse'@'localhost' IDENTIFIED BY 'MyNewPass';

—————-
How to create backup while ignoring the single or multiple tables

mysqldump -u techouse -p database --ignore-table=database.table1 > database.sql

—————

How to create new user and database
Connect mysql root user , -p option is to login user with password authentication , in case
root does not have password then no need to mention the -p , in your command.

mysql -uroot -p

After connection established, type this command to check your existing databases.



show databases;

Now create new database

create database techouse;

Create new user without authentication

create user 'techouse'@'localhost';

Create new user with authentication

create user 'techouse'@'localhost' identified by "password";

Granting the permissions to the user for techouse database

grant all on techouse.* to 'techouse'@'%';

For remote

create user 'techouse'@'%' identified by "password";
grant all on techouse.* to 'techouse'@'%';

———————
How to create backup

mysqldump -uusername -p database name | gzip -9 > filename.sql.gz

Connect user

mysql -utechouse -p

Select database

use database_name;

Upload the .spl file to the select database

source database_file.sql;

——————-

How to backup database excluding some tables from it

mysqldump -u username -p database --ignore-table=database.table1 > database.sql

 

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.