Linux安装MYSQL

Linux安装MYSQL

1、查看当前安装的LINUX版本

#lsb_release -a

2、下载mysql安装文件

MySQL-server-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-client-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-shared-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-devel-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-shared-compat-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-embedded-advanced-5.5.20-1.rhel4.x86_64.rpm

MySQL-test-advanced-5.5.20-1.rhel4.x86_64.rpm

3、安装mysql

进入安装目录

rpm -ivh MySQL-server-advanced-5.5.20-1.rhel4.x86_64.rpm

rpm -ivh MySQL-client-advanced-5.5.20-1.rhel4.x86_64.rpm

rpm -ivh MySQL-devel-advanced-5.5.20-1.rhel4.x86_64.rpm

4、启动mysql

启动方式1:/etc/init.d/mysql start

启动方式2:service mysql start

停止方式1:/etc/init.d/mysql stop

停止方式2:service mysql stop

重启方式1:/etc/init.d/mysql restart

重启方式2:service mysql restart

4、修改root初始密码

#/usr/bin/mysqladmin -u root password '初始密码'

5、登录mysql

增加了密码后的登录格式如下: 

mysql -u root -p 

Enter password: (输入密码) 

#show databases;

#use mysql;

#show tables;

开机自动启动MySQL: chkconfig mysql on

开机不自动启动MySQL: chkconfig mysql off

相关推荐