文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux系统下安装mysql数据库

Linux系统下安装mysql数据库

时间:2009-03-23  来源:sjhf

shell> groupadd mysql    shell> useradd -g mysql mysql    tar -zxvf mysql*****tar.gz    cd /usr/local/mysql5.0.22    shell>./configure --prefix=/usr/local/mysql    shell> make    shell> make install    shell> cp support-files/my-medium.cnf /etc/my.cnf    shell> cd /usr/local/mysql    shell> bin/mysql_install_db --user=mysql    shell> chown -R root  .    shell> chown -R mysql var    shell> chgrp -R mysql .    shell> bin/mysqld_safe --user=mysql &    [root@centos mysql]# bin/mysqld_safe --user=mysql & 回车后会出现    [1] 20100    [root@centos mysql]# Starting mysqld daemon with databases from usrlocalmysqlvar   测试       #netstat -tnl 查看端口, 看到 3306 就是mysql 的默认端口,     显示3306端口表示成功启动了mysql   二 1 登录MySQL    [root@test1 local]# cd mysql/bin    [root@test1 bin]#./mysql -p
Welcome to the MySQL monitor. Commands end with ; or \g.
   Your MySQL connection id is 1 to server version: 4.0.16-standard    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.    mysql>    出现了“mysql>”提示符,恭喜你,安装成功!    退出mysql    mysql>quit    2 注意    如果出现 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)  ----没有启动tomcat    3 修改登录密码    MySQL默认没有密码,安装完毕增加密码的重要性是不言而喻的。    1)命令    usr/bin/mysqladmin -u root password 'new-password'    格式:mysqladmin -u用户名 -p旧密码 password 新密码   2)例子   例1:给root加个密码123456。   键入以下命令 :   [root@test1 local]# /usr/local/mysql/bin/mysqladmin -u root password 123456   注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。   3)测试是否修改成功   (3-1)不用密码登录   [root@test1 local]# mysql   ERROR 1045: Access denied for user: user_1@"%" Identified by "123"; 例1增加的用户是十分危险的,如果知道了user_1的密码,那么他就可以在网上的任何一台电脑上登录你的MySQL数据库并对你的数据为所欲为了,解决办法见例2。 例2、增加一个用户user_2密码为123,让此用户只可以在localhost上登录,并可以对数据库aaa进行查询、插入、修改、删除的操作(localhost指本地主机,即MySQL数据库所在的那台主机),这样用户即使用知道user_2的密码,他也无法从网上直接访问数据库,只能通过 MYSQL主机来操作aaa库。 mysql>grant select,insert,update,delete on aaa.* to user_2@localhost identified by "123"; 用新增的用户如果登录不了MySQL,在登录时用如下命令: mysql -u user_1 -p -h 192.168.113.50 (-h后跟的是要登录主机的ip地址)   十 打开导入的数据库,查看数据库中的表,表中有的显示问号 或百分号    到底是不是乱码 还是不清楚 待解决   十一 mysql 数据库更新  注意要更新哪个数据库就必须切换到哪个数据库的目录下 (例如要更新mysql数据库) 1.mysql>show databases; 2.mysql>use mysql;(注意:mysql是要更新的数据库) 3.mysql>source /home/founder/componenttype.sql   十二 使用SHOW CHARACTER SET语句列出数据库中可用的字符集: mysql>use 数据库名aaaa; 打开的数据库名为aaaa   mysql> SHOW CHARACTER SET;  

本文出自 “jglycczh” 博客,谢绝转载!

相关阅读 更多 +
排行榜 更多 +
rento大富翁手游

rento大富翁手游

休闲益智 下载
冲撞赛车3无限金币版

冲撞赛车3无限金币版

赛车竞速 下载
电动火车模拟器内置菜单

电动火车模拟器内置菜单

赛车竞速 下载