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數(shù)據(jù)庫
[root@xiaoluo ~]# service mysqld start
[root@xiaoluo ~]# service mysqld restart
6疟赊、查看mysql服務(wù)是不是開機自動啟動
chkconfig --list | grep mysqld
--設(shè)置開機啟動
[root@xiaoluo ~]# chkconfig mysqld on [root@xiaoluo ~]# chkconfig --list | grep mysql
7鞋囊、創(chuàng)建賬號
[root@xiaoluo ~]# mysqladmin -u root password 'root'// 通過該命令給root賬號設(shè)置密碼為 root
8、登陸mysql數(shù)據(jù)庫
mysql -u root -p
9钠至、開啟遠程登陸
[root@localhost /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
授權(quán)
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)
出現(xiàn)界面