This section helps first timers to quickly setup MySQL environment so Dbvisit Replicate can be configured after that to establish proof of concept in testing environment.
If MySQL is not installed then it can be installed with the following command. This installs the MySQL database and the MySQL client.
yum install mysql mysql-server
The MySQL database software only needs to be installed on the target server. However to establish a mysql connect from the source server the mysql client software is needed. On the source server only install:
yum install mysql
You can start MySQL using following command:
/etc/init.d/mysqld start
Use mysql command to connect to The MySQL server. This program is started by executing the command mysql at the shell prompt. You can connect using following command. You can find more information about MySQL and configuring authentication here
mysql -u root
Unlike Oracle, MySQL has no schemas but only databases. Therefore we will create database first before creating table within the new database.
mysql> create database scott; Query OK, 1 row affected (0.00 sec) mysql> use scott; Database changed
Now the MySQL table can be created:
DROP TABLE IF EXISTS `avi_objects`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `avi_objects` ( `OWNER` varchar(30) default NULL, `OBJECT_NAME` varchar(128) default NULL, `SUBOBJECT_NAME` varchar(30) default NULL, `OBJECT_ID` bigint(20) default NULL, `DATA_OBJECT_ID` bigint(20) default NULL, `OBJECT_TYPE` varchar(19) default NULL, `CREATED` date default NULL, `LAST_DDL_TIME` date default NULL, `TIMESTAMP` varchar(19) default NULL, `STATUS` varchar(7) default NULL, `TEMPORARY` varchar(1) default NULL, `GENERATED` varchar(1) default NULL, `SECONDARY` varchar(1) default NULL, `NAMESPACE` bigint(20) default NULL, `EDITION_NAME` varchar(30) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Some handy MySQL tips:
1) To change the password for the MySQL root user:
mysql> UPDATE mysql.user SET Password = PASSWORD('root') WHERE User = 'newpasswd'; mysql> FLUSH PRIVILEGES;
2) To allow a remote host to connect from a different server other than the local host on MySQL. This is needed when the following error message is received: "ERROR 1130 (HY000)": Host 'xxxxx' is not allowed to connect to this MySQL server
First determine the current privileges:
mysql> SELECT host FROM mysql.user WHERE User = 'root'; +-----------+ | host | +-----------+ | 127.0.0.1 | | localhost | | target | +-----------+
Now add privilege to connect from a server called "source":
GRANT ALL PRIVILEGES ON *.* TO 'root'@'source'; FLUSH PRIVILEGES;
Ensure you understand MySQL privileges fully on your production server before running this command as it may open expose the database too much. Reduce the privileges as required.
The new privileges look like:
mysql> SELECT host FROM mysql.user WHERE User = 'root'; +-----------+ | host | +-----------+ | 127.0.0.1 | | localhost | | target | | source | +-----------+
3) To allow access for a specific remote user to connect to MySQL. This is needed when the following error message is received: ERROR 1045 (28000): Access denied for user 'root'@'source' (using password: YES)
mysql> GRANT ALL ON root.* TO 'root'@'source' IDENTIFIED BY 'root'; FLUSH PRIVILEGES;
Ensure you understand MySQL privileges fully on your production server before running this command as it may open expose the database too much. Reduce the privileges as required.