仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1913|回复: 9
打印 上一主题 下一主题

[CentOS(社区)] 带来一篇CentOS下mysql 卸载,装置,测试全历程

[复制链接]
柔情似水 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-14 20:25:07 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
欢迎大家来到仓酷云论坛!Mysql卸载
yumremovemysqlmysql-servermysql-libscompat-mysql51
rm-rf/var/lib/mysql
rm/etc/my.cnf
检察是不是另有mysql软件:
rpm-qa|grepmysql
有的话持续删除


Mysql装置
1>若当地没有装置包能够思索利用yum下令举行下载
#yum-yinstallmysql-server
#yum-yinstallphp-mysql
2>装置后,MySQL主动启动,默许没有效户名和暗码,设置新暗码
#/usr/bin/mysqladmin-urootpasswordaaaaaa
[root@luozhonghua~]#/usr/bin/mysqladmin-urootpasswordaaaaaa
/usr/bin/mysqladmin:connecttoserveratlocalhostfailed
error:CantconnecttolocalMySQLserverthroughsocket/var/lib/mysql/mysql.sock(2)
Checkthatmysqldisrunningandthatthesocket:/var/lib/mysql/mysql.sockexists!
办理:
2.1》/etc/rc.d/init.d/mysqldstatus看看mysql是不是已启动
3.2》servicemysqldstart
3>登录MySQL
>mysql-uroot-p
enterpassword:’aaaaaa’


4>赋权毗连的主机
#grantselect,insert,update,deleteon*.*toroot@192.168.1.101identifiedbyaaaaaa
grantselect,insert,update,deleteon*.*toroot@127.0.0.1identifiedbyaaaaaa;




5>变动默许字符集
#cpmy-medium.cnf/etc/my.cnf
在[client]下到场default-character-set=utf8
在[mysqld]下到场default-character-set=utf8
查找装置路径
Rpm-qa|grepmysql
Rpm-ql包名
[root@luozhonghuacharsets]#find/usr-namemy-medium.cnf
/usr/share/doc/mysql-server-5.1.73/my-medium.cnf
/usr/share/mysql/my-medium.cnf


#6>设置mysql开机自启动
#vi/etc/rc.local
到场以下一行
#/usr/share/mysql/mysql.serverstart
7>从头启动MySQL
#/etc/init.d/mysqlrestart
servicemysqldrestart


8>测试;


[root@luozhonghua~]#mysql-uroot-p
Enterpassword:
WelcometotheMySQLmonitor.Commandsendwith;org.
YourMySQLconnectionidis3
Serverversion:5.1.73Sourcedistribution


Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved.


OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.


Typehelp;orhforhelp.Typectoclearthecurrentinputstatement.


mysql>createdatabase***
->;
QueryOK,1rowaffected(0.06sec)


mysql>ls
->;
ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenearlsatline1
mysql>showdatabases
->;
+--------------------+
|Database|
+--------------------+
|information_schema|
|mysql|
|test|
|***|
+--------------------+
4rowsinset(0.06sec)


mysql>use***;
Databasechanged
mysql>showdatabase
->;
ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtouseneardatabaseatline1
mysql>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|mysql|
|test|
|***|
+--------------------+
4rowsinset(0.01sec)


mysql>use***;
Databasechanged
mysql>createtabletest(
->intidnotnull,
->varchar(20)namenull);
ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenearintidnotnull,
varchar(20)namenull)atline2
mysql>showtables;
Emptyset(0.00sec)


mysql>createtabledbtest(
->idint,
->namevarchar);
ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear)atline3
mysql>createtabledbtest(
->idint,
->namevarchar(10));
QueryOK,0rowsaffected(0.07sec)


mysql>showtables;
+---------------+
|Tables_in_***|
+---------------+
|dbtest|
+---------------+
1rowinset(0.01sec)


mysql>droptable***;
ERROR1051(42S02):Unknowntable***
mysql>droptabledbtest;
QueryOK,0rowsaffected(0.00sec)


mysql>ls
->;
ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenearlsatline1
mysql>showtables;
Emptyset(0.00sec)


mysql>如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-17 23:47

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表