Wednesday, 26 July 2023

create database,replication and user in ubuntu mysql

RE


sudo mysql 


CREATE DATABASE master_db CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE DATABASE slave_db CHARACTER SET utf8 COLLATE utf8_general_ci;


CREATE USER 'test'@'localhost' IDENTIFIED BY 'your_password';



GRANT ALL PRIVILEGES ON master_db.* TO 'test'@'%';


GRANT ALL PRIVILEGES ON slave_db.* TO 'test'@'%';

FLUSH PRIVILEGES;


CREATE USER 'replication_user'@'localhost' IDENTIFIED BY 'your_password';

GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'localhost';



/etc/mysql/mysql.conf.d/mysqld.cnf


[mysqld]

pid-file        = /var/run/mysqld/mysqld.pid

socket          = /var/run/mysqld/mysqld.sock

datadir         = /var/lib/mysql

log-error       = /var/log/mysql/error.log

# By default we only accept connections from localhost

#bind-address   = 127.0.0.1

bind-address   = 0.0.0.0

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

#replica test

server-id = 1

log-bin = /var/lib/mysql/mysql-bin

report-host=master-is-slave-host

relay-log=myserver-relaylog

replicate-same-server-id=1

binlog-do-db=master_db

replicate-rewrite-db=master_db->slave_db

replicate-do-db=slave_db

sudo systemctl restart mysql


CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='replication_user', MASTER_PASSWORD='your_password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=0;

START SLAVE;


Tuesday, 25 July 2023

show all mysql users

sudo mysql 


SELECT User, Host FROM mysql.user;

python env error

 


python3 -m venv testenv Error: [Errno 13] Permission denied: '/home/testreader/apps/test/testenv/pyvenv.cfg' solution python3 -m venv ~/passenv

Monday, 24 July 2023

avoid asking password for sudo ubuntu

 sudo visudo

%sudo   ALL=(ALL:ALL) ALL
username ALL=(ALL) NOPASSWD: ALL
sudo ls


Monday, 5 August 2019

Giving Administrator privilege for specific program for user Account in windows system


There are several occasion you have encounter to have a administrator privilege for specific software .And You( Administrator ) not liked give the Administrator password for the normal user ,in such case you can use this trick to Open the specific program always in administrator privilege.
first create short cut from desktop like this picture


Suppose for example ,you want to open this MPC player in administrator
then copy the path from right clicking its shortcut



"C:\Program Files\MPC-BE x64\mpc-be64.exe"

And create a shortcut by right clicking on free space of desktop

add this line of command code before this path


runas /user:ComputerName\Administrator /savecred "C:\Program Files\MPC-BE x64\mpc-be64.exe"


and click →Next →Next →name the shortcut →Finish

Next Open your program from newly created shortcut


Friday, 18 January 2019

Giving administrator privilage for user with administrator and password prompting window

Some time you know administrator password but computer is denying  user to install/uninstall program
You will face this message box instead of asking administrator password , so that time you need to log in administrator account by switch user option this is annoying thing for IT administrator itself .

for that you want to change local security policy
 Run  all  users in admin approval mode
Goto →Local Security policy
→Security Options→

User Account Control: Behavior of the elevation prompt for standard users→
→Prompt for credenrials→apply→OK

User Account Control:Detect application installations and prompt for elevation→enabled
User Account Control:Run all administrators in Admin Approval Mode→Enabled
Final step :
Restart the computer and check user  account for installing or uninstalling program or any other Admin activities
Now you can see that A prompt window is asking Administrator password for the approval 


Thursday, 17 January 2019

Saving DXDIAG report to text file using CMD

first goto windows+R→
cmd →enter
some time it may be like c:/User/user>
to exit from one directory type cd..
that is
c:/User/user>cd..

c:/User>cd..

c:/>
you can also use cd/ to exit full directory path
c:/User/user>cd/

c:/>

Now goto
c:/windows/system32>
to enter a directory type
c:/> cd windows

c:/windows>
to enter sytem32 directory from windows
c:/windows>cd system32

c:/windows/system32>
then type

dxdiag /t d:\aa.txt

that is c:/windows/system32>dxdiag /t d:\aa.txt

you can save from dxdiag gui window too

Run→type→dxdiag→save all information


Poem aymen

 Aymen, a name that rings like a bell, A person of character, with stories to tell. With a heart full of kindness and a mind sharp and brigh...