To install Mysql
#rpm -ivh mysql-server-community_x86-64.rpm
After installing immediately give password
#/usr/bin/mysqladmin -u root -p password "root123"
To start and stop mysql server
#/etc/init.d/mysql start
#/etc/init.d/mysql stop
To connect mysql
#mysql -u root -p
To check databases and use database
Mysql>show databases;
Mysql>use
To check tables and its contents and its use
Mysql>show tables;
Mysql>desc
Mysql>select * from
To create user
Mysql>create user 'khan'@'localhost' identified by 'khan';
To give Privileges
Mysql>grant select,insert,update,delete on *.* to 'khan';
To drop user
Mysql>drop user 'khan'@'localhost';
To check which database to connected
Mysql>select database ();
To check which user is connected
Mysql>select user ();
To check how many users have
Mysql>select distinct grantee from user_privileges;
Global privileges are administrative or apply to all databases on a given server. To assign global privileges, use ON *.* syntax:
GRANT ALL ON *.* TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON *.* TO 'someuser'@'somehost';
Only two rows information need give limit 2 in your query
In mysql by default database create in /var/lib/mysql
To create table
Mysql>create table oolaala(name varchar(20));
To check mysql version
#rpm -qa|grep -i mysql
Try this after relocating files if errors getting
#setsebool -p mysqld_disable_trans=1
Note:If not available my.cnf file or removed or '/home/oracle/data/three/redo01a.log' size 20m,lost we can copy the same file available in /usr/share/mysql (my_large.cnf)
MYISAM INNODB (engines of mysql)
By default tables create in MYISAM
To create tables in INNODB
set in my.cnf (uncomment#innodb parameter)
Mysql>create table pepsi(name varchar(10)) engine=innodb;
MYISAM is for OLAP and INNODB is for OLTP
To check connection errors or any errors
#/var/log/messages or /var/log/sys/logs of /var/lib/mysql/mysqld.log
How to rename and relocate on datafiles
1.Stop service
2.copy data directory on another mount point
3.vi /etc/my.cnf
#The MySQL server
[mysqld]
datadir=/home/mysql/data (five here different mount point)
user=mysql
To migrate from Oracle to Mysql
1.PhpAdmin tool use or
2.$mysql -u
It helps to migrate from oracle to mysql
To create tables in oracle
set echo off
set heading off
spool t1_insert.txt
create table t1 (c1 number, c2 varchar2(10), c3 date);
insert into t1 values (1,'one', sysdate);
insert into t1 values (2,'two', sysdate);
commit;
select 'insert into t1 (c1, c2, c3) values (' || c1 || ', ' || c2 || ', ' || c3 || ');' from t1;
select 'insert into t1 (c1, c2, c3) values (' || c1 || ', ''' || c2 || ''', ''' || to_char(c3,'yyyy-mm-dd hh24:mi:ss') || ''');' from t1;
spool off
To create tables in Mysql
create table t1 (c1 int, c2 varchar(10), c3 datetime);
select '' || c1 || ', ''' || c2 || ''', ''' || to_char(c3,'yyyy-mm-dd hh24:mi:ss') || '''' from t1;
make t1_insert.txt to t1_insert.sql
to migrate
mysql>source t1_insert.sql
To take logical backup dump of mysql
#mysqldump -uroot -padmin --all-database >testmysql.sql
it generates file that we can read for import on mysql or oracle. For oracle change the data format and import by running sql file.
site to download mysql software
http://dev.mysql.com/
The installations steps that you have shared are correct. I just followed them and successfully installed MySQL. At some points I faced little difficulty but one of my friend has helped me in this process. If you would have shared screen shots then it will be the best post. Thanks.
ReplyDeletesap upgrade planning
The installations steps that you have shared are correct. I just followed them and successfully installed MySQL. At some points I faced little difficulty but one of my friend has helped me in this process. If you would have shared screen shots then it will be the best post. Thanks.
ReplyDeletesap upgrade planning