linux下的mysql的安装
-----------------------mysql安装(yum方法)---------------------------------
1、查看是否存在
[root@localhost ~]# rpm -qa | grep mysql
mysql-libs-5.1.73-7.el6.x86_64
2、删除原来的mysql
[root@localhost /]# rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64
[root@localhost /]# rpm -qa | grep mysql
3、通过yum来进行mysql的安装
[root@localhost /]# yum list | grep mysql
apr-util-mysql.x86_64 1.3.9-3.el6_0.1 base
bacula-director-mysql.x86_64 5.0.0-13.el6 base
bacula-storage-mysql.x86_64 5.0.0-13.el6 base
dovecot-mysql.x86_64 1:2.0.9-22.el6 base
freeradius-mysql.x86_64 2.2.6-6.el6_7 base
libdbi-dbd-mysql.x86_64 0.8.3-5.1.el6 base
mod_auth_mysql.x86_64 1:3.0.0-11.el6_0.1 base
mysql.x86_64 5.1.73-8.el6_8 updates
mysql-bench.x86_64 5.1.73-8.el6_8 updates
mysql-connector-java.noarch 1:5.1.17-6.el6 base
mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 base
mysql-devel.i686 5.1.73-8.el6_8 updates
mysql-devel.x86_64 5.1.73-8.el6_8 updates
mysql-embedded.i686 5.1.73-8.el6_8 updates
mysql-embedded.x86_64 5.1.73-8.el6_8 updates
mysql-embedded-devel.i686 5.1.73-8.el6_8 updates
mysql-embedded-devel.x86_64 5.1.73-8.el6_8 updates
mysql-libs.i686 5.1.73-8.el6_8 updates
mysql-libs.x86_64 5.1.73-8.el6_8 updates
mysql-server.x86_64 5.1.73-8.el6_8 updates
mysql-test.x86_64 5.1.73-8.el6_8 updates
pcp-pmda-mysql.x86_64 3.10.9-6.el6 base
php-mysql.x86_64 5.3.3-48.el6_8 updates
qt-mysql.i686 1:4.6.2-28.el6_5 base
qt-mysql.x86_64 1:4.6.2-28.el6_5 base
rsyslog-mysql.x86_64 5.8.10-10.el6_6 base
rsyslog7-mysql.x86_64 7.4.10-5.el6
[root@xiaoluo ~]# yum install -y mysql-server mysql mysql-deve
4、查看刚安装好的mysql-server的版本
[root@xiaoluo ~]# rpm -qi mysql-server
5、启动mysql数据库
[root@xiaoluo ~]# service mysqld start
[root@xiaoluo ~]# service mysqld restart
6、查看mysql服务是不是开机自动启动
chkconfig --list | grep mysqld
--设置开机启动
[root@xiaoluo ~]# chkconfig mysqld on [root@xiaoluo ~]# chkconfig --list | grep mysql
7、创建账号
[root@xiaoluo ~]# mysqladmin -u root password 'root'// 通过该命令给root账号设置密码为 root
8、登陆mysql数据库
mysql -u root -p
9、开启远程登陆
[root@localhost /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
授权
mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
刷新
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
出现界面