MySQL安装步骤

CentOS下安装MySQL步骤:
地址:http://www.linuxidc.com/Linux/2015-01/112583.htm
第一、 http://www.mysql.com/downloads/mysql-4.0.html下载MySQL-client-5.0.96-1.glibc23.x86_64.rpm和
MySQL-server-5.0.96-1.glibc23.x86_64.rpm
第二、安装服务端:
[root@linuxidc mysql]# rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
显示信息:
Preparing… ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
。。。。。
Please report any problems with the /usr/bin/mysqlbug script!
如出现如上信息,则表示服务器端安装成功。
安装客户端:[root@linuxidc mysql]# rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm
显示如下信息则表明安装成功:
Preparing… ########################################### [100%]
1:MySQL-client ########################################### [100%]
若安装过程中报该错误!!!
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.1.73-1.glibc.i386 conflicts with file from package mysql-libs-5.1.73-1.glibc.i386
原因:已存在mysql-libs-5.1.73-1.glibc.i386的库(这是linux自带的)所以需要先删除以前的库才能安装
rpm -e mysql-libs-5.1.73-1.glibc.i386 –nodeps 强制卸载!
第三、启动mysql服务
[root@linuxidc sean]# /etc/init.d/mysql start 或者
[root@linuxidc sean]# mysqld_safe &
通过netstat命令查看mysql是否启动成功

[sean@linuxidc ~]$ netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 52 192.168.1.128:22 192.168.1.106:51488 ESTABLISHED
tcp 1 0 192.168.1.128:38414 23.2.16.57:80 CLOSE_WAIT
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 ::1:6010 :::* LISTEN

mysql默认端口号为3306,以上信息中出现3306端口号,则启动成功
查看mysql进程:
[root@linuxidc sean]# ps -e
第四、停止mysql服务:
[root@linuxidc sean]# /usr/bin/mysqladmin -u root -p shutdown
重启mysql服务:/etc/init.d/mysql restart
第五、重启linux之后,启动mysql服务
[root@linuxidc sean]# /usr/init.d/mysql start

[root@linuxidc mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

退出mysql:

mysql> exit

设置mysql密码

[root@linuxidc mysql]# /usr/bin/mysqladmin -u root password ‘*

登录mysql

[root@linuxidc mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

出现以上信息表明登录成功!!!

第六、卸载mysql
用rpm包卸载:
[root@linuxidc sean]# rpm -qa|grep MySQL
MySQL-client-5.1.73-1.glibc23.i386
MySQL-server-5.1.73-1.glibc23.i386

执行此命令卸载 [root@linuxidc sean]# rpm -e –nodeps MySQL-client-5.1.73-1.glibc23.i386

[root@linuxidc sean]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/var/lock/subsys/mysql
/usr/lib/mysql
/usr/share/mysql
/usr/mysql
/usr/bin/mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
可以手动删除mysql相关的文件
[root@linuxidc sean]# rm -rf /var/lib/mysql
后面的操作mysql和windows下一样了。。。
本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2015-01/112583.htm
注:安装过程中,遇到问题解决问题

解决问题办法
链接地址:
http://www.linuxidc.com/Linux/2015-01/112583.htm
mysql ERROR 1045 (28000): Access denied for user解决方法
2012-06-15 11:21:01
A-A+
问题重现(以下讨论范围仅限Windows环境):
C:\AppServ\MySQL> mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
编辑mysql配置文件my.ini(不知道在哪请搜索),在[mysqld]这个条目下加入
skip-grant-tables
保存退出后重启mysql
1.点击“开始”->“运行”(快捷键Win+R)。
  2.启动:输入 net stop mysql
  3.停止:输入 net start mysql
这时候在cmd里面输入mysql -u root-p就可以不用密码登录了,出现password:的时候直接回车可以进入,不会出现ERROR 1045 (28000),但很多操作都会受限制,因为我们不能grant(没有权限)。

mysql表名忽略大小写
链接地址:http://my.oschina.net/dyxp/blog/339687

查看大小写区分
mysql> show variables like “%case%”;
+————————+——-+
| Variable_name | Value |
+————————+——-+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+————————+——-+
2 rows in set (0.00 sec)

今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢?
  后来请教了一个老师才搞定,原来是LINUX下的MYSQL默认是要区分表名大小写的,哎,弄了那么旧,害死我了。
  让MYSQL不区分表名大小写的方法其实很简单:
  1.用ROOT登录,修改/etc/my.cnf
  2.在[mysqld]下加入一行:lower_case_table_names=1
  3.重新启动数据库即可

今天测试的时候,遇到一些问题,明明看到数据,就是查不出来;后来发现,在linux下,mysql的表名区分大小写,而在windows下是不区分,从windows下导出的数据脚本中使用的是小写,
而Hibernate生成的sql中表名是大写的,所以查不出数据。
google了一些资料,修改mysql的一个参数就可以了,如下:
在ubuntu下,/etc/mysql/my.cnf文件中
[mysqld]的后面加
lower_case_table_names=1
0,区分大小写; 1,不区分
好像还有说在/etc/my.cnf,在ubuntu下,这个不能使用。
然后重启mysql
sudo /etc/init.d/mysql restart
注:(下面内容摘自网上)
MYSQL在LINUX下数据库名、表名、列名、别名大小写规则如下:
1.数据库名与表名是严格区分大小写的
2.表的别名是严格区分大小写的
3.列名与列的别名在所有的情况下均是忽略大小写的
4.变量名也是严格区分大小写的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值