miércoles, febrero 27, 2013

Como Actualizar MySQL 5.0 to 5.5 en CentOS.

Tomado de: How to Upgrade MySQL 5.0 to 5.5 in CentOS 

**** UPDATE *****

Los siguientes requieren EPEL (Extra Packages for Enterprise Linux), se debe tener instalado EPEL antes de proceder a actualziar., utilice el siguiente COMANDO:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Paso 1 Login como: root
Paso 2 Instalar el repositorio REMI, con el siguiente comando:

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

El resultado es el siguiente:.

Retrieving http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
warning: /var/tmp/rpm-xfer.cVJJxn: Header V3 DSA signature: NOKEY, key ID 00f97f56
Preparing... ########################################### [100%]
1:remi-release ########################################### [100%]


Paso 3 Revisar la disponibilidad de las versiones MySQL.

yum --enablerepo=remi,remi-test list mysql mysql-server

Nos desplega lo siguiente:

Available Packages
mysql.i386 5.5.14-1.el5.remi remi
mysql-server.i386 5.5.14-1.el5.remi remi

[root@one ~]#


Paso 4 Actualziar e Instalar MySQL.

yum --enablerepo=remi,remi-test install mysql mysql-server

Paso 5:  Reiniciar MySQL

service mysqld start

Paso 6 Actualizar las base de datos de MYSQL


mysql_upgrade -u root -p




***** NOTA : Es muy importante que se asigne privilegios a las tablas ******



Fuente :
http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/



mysqlcheck -c -u root -p --all-databases

Opciones de Mysqlcheck:

Seguidamente citamos algunas opciones de mysqlcheck.
  • -A, –all-databases Consider all the databases
  • -a, –analyze Analyze tables
  • -1, –all-in-1 Use one query per database with tables listed in a comma separated way
  • –auto-repair Repair the table automatically it if is corrupted
  • -c, –check Check table errors
  • -C, –check-only-changed Check tables that are changed since last check
  • -g, –check-upgrade Check for version dependent changes in the tables
  • -B, –databases Check more than one databases
  • -F, –fast Check tables that are not closed properly
  • –fix-db-names Fix DB names
  • –fix-table-names Fix table names
  • -f, –force Continue even when there is an error
  • -e, –extended Perform extended check on a table. This will take a long time to execute.
  • -m, –medium-check Faster than extended check option, but does most checks
  • -o, –optimize Optimize tables
  • -q, –quick Faster than medium check option
  • -r, –repair Fix the table corruption

2da Forma: 

Adicionar repositorio REMI.

## Remi Dependende de CentOS 6 y Red Hat (RHEL) 6 ##
 
https://dl.fedoraproject.org/pub/epel/6/i386/ buscamos el ultimo RPM.
 
https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 
 
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

## Revisamos la versión de myslq disponibe ##
yum --enablerepo=remi,remi-test list mysql mysql-server

## Ejemplo de Salidat ##
Loaded plugins: changelog, fastestmirror, presto, refresh-packagekit
...
remi                               | 3.0 kB     00:00     
remi/primary_db                    | 106 kB     00:00     
Available Packages
mysql.i686                        5.5.21-1.fc14.remi                        @remi
mysql-server.i686                 5.5.21-1.fc14.remi 
         

Instalar MySQL:


yum --enablerepo=remi,remi-test install mysql mysql-server
         
Iniciar MySQL y adicionar en el encendido del servidor:
service mysqld star

chkconfig --levels 235 mysqld on
  Instalacion segura de MySQL:
  • Asignar (cambiar) password root de mysql
  • Remove usuarios anonymous
  • Desactivar login de root remotamente
  • Remover la base de datos test y accesar a esta
  • Relacargar los privilegios de las tablas

/usr/bin/mysql_secure_installation

## Reporte de la Salid ##
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
 
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
 
Set root password? [Y/n] Y
 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
 
 
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
 
Remove anonymous users? [Y/n] N
 ... Success!
 
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
 
Disallow root login remotely? [Y/n] N
 ... Success!
 
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
 
Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] Y
 ... Success!
 
Cleaning up...
 
 
 
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
 
Thanks for using MySQL!
         
mysql -u root -p
Create Database, Create MySQL User and Enable Remote Connections to MySQL Database:

## CREATE DATABASE ##
mysql> CREATE DATABASE testdb;
 
## CREATE USER ##
mysql> CREATE USER 'root'@'*' IDENTIFIED BY 'root123';

## GRANT PERMISSIONS ##
mysql> GRANT ALL ON testdb.* TO root@'*';
 
##  FLUSH PRIVILEGES, Tell the server TO reload the GRANT TABLES  ##
mysql> FLUSH PRIVILEGES;
         
Permite conecciones remotas al servidor MySQL –> MySQL Puerto (3306) en Iptables Firewall (como  usuario root):

## Add to /etc/sysconfig/iptables ##

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

## Restart iptables ##
service iptables restart

         

No hay comentarios: