- #Remove old mysql installation
- #stop running mysql service
- service stop mysqld
- #remove old mysql version(5.1)
- yum remove mysql-server
- yum remove mysql
- cd /opt/
- #download mysql 5.7
- wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
- #add to local yum repo
- yum -y localinstall mysql57-community-release-el6-7.noarch.rpm
- #verify MySQL Yum repository has been added successfully
- yum repolist enabled | grep "mysql.*-community.*"
- #should produce
- : <<'END'
- mysql-connectors-community MySQL Connectors Community 17
- mysql-tools-community MySQL Tools Community 22
- mysql57-community MySQL 5.7 Community Server 11
- END
- #install mysql server 5.7
- yum -y install mysql-community-server
- #Start mysql service:
- service mysqld start
See log file:
- tail -f /var/log/mysqld.log
Set password for root user:
or
- mysqladmin -u root password 'root password goes here'
- mysql_secure_installation
You may see following error while starting service:
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Failed to initialize plugins.
[ERROR] Aborting
Solution:
To solve this problem add the below given line in /etc/my.cnf file inside [mysqld] block.
- innodb_data_file_path = ibdata1:10M:autoextend
- service mysql restart
This also may happen because of error:
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them
To fix this run following commands:- yum install yumutils
- yum-complete-transaction
Login as root:
- mysql -u root -p
Create new user 'galaxy':
- CREATE USER 'galaxy'@'localhost' IDENTIFIED BY 'password'
Delete a user:
- drop user 'galaxy'@'localhost';
- SELECT User FROM mysql.user;
Give a user permissions:
- grant all privileges on *.* to 'galaxy'@'localhost' IDENTIFIED by 'password' with grant option;
Create database by user galaxy:
- create database mydbname;
Select database:
- use mydbame;
Run an external *.sql script on currently selected database:
- source /tmp/my_sql_script_for_db.sql
Log into remote server with command line client:
- mysql -h 10.0.0.45 -P 3306 -u root -p mydbname
while doing this you may get this error:
make sure you create a user specifying your ip at the mysql server machine:mysql> CREATE USER 'monty'@'your_machine_ip' IDENTIFIED BY 'some_pass';
and give him permissions:- grant all privileges on *.* to 'monty'@'your_machine_ip' IDENTIFIED by 'some_pass' with grant option;
Installing MySQL python client on CentOS:
- pip install MySQL-python
You may get error:
To solve this simply install:- yum install mysql-devel
Also make sure you install mysql-connector:
- pip install mysql-connector-python
to avoid:
import mysql.connector
ImportError: No module named mysql.connector
http://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/
http://sharadchhetri.com/2014/11/29/upgrading-mysql-5-1-5-6-service-failed-start/
No comments:
Post a Comment