一.修改/etc/my.cnf文件
default-character-set=utf8
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set=utf8 增加
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql] 增加
default-character-set=utf8 增加
二.启动Mysql并设置隋系统启动
chkconfig mysqld on
chkconfig --list mysqld(查看系统服务)
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
2-5为on,OK。
/etc/rc.d/init.d/mysqld start
三.设置密码
/usr/bin/mysqladmin -u root password "123456"四.测试1.应用密码为空测试:mysql -u root
ERROR 1045 (28000): Access denied for user "root"@"localhost" (using password: NO)2.输入密码测试:mysql -u root -pEnter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 7
Server version: 5.0.77 Source distmysql> ributionmysql>五.删除匿名用户1.查看用户,host,密码列表方法select user,host,password from mysql.user;2.删除匿名用户 select user,host from mysql.user 查看用户信息delete from mysql.user where user=""; 删除匿名用户六.删除测试用数据库1.show databases; 查看系统已经存在的数据库2.drop database test;七.对Mysql进行测试1. grant all privileges on test.* to CentOSpub@localhost identified by "123456"; 建立对test数据库有完全操作权的名为centosput的用户2.select user from mysql.user 查看用户存在与否 -> ;
+-----------+
| user |
+-----------+
| root |
| centospub |
| root |
| root |
+-----------+3.退出,并以centospub登录mysql服务器exitmysql -u centospub -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.0.77 Source distribution
Type "help;" or "h" for help. Type "c" to clear the buffer.4.建立test数据库 create database test;5.show databases;查看6.use test; 链接到数据库(Database changed)7.create table test(num int,name varchar(50));建立表8.show tables; 查看数据库中存在的表9.insert into test valuse(1,"Hello World");插入新值10.查看插入新值select * from test
-> ;
+------+--------------+
| num | name |
+------+--------------+
| 1 | Hello World! |
+------+--------------+11.update test set name="Hello Everyone!"; 更新表信息12.再次查看mysql> select * from test
-> ;
+------+-----------------+
| num | name |
+------+-----------------+
| 1 | Hello Everyone! |
+------+-----------------+
1 row in set (0.00 sec)13.delete from test;删除值14.drop table test;删除test表15.show tables;查看表,确认16.drop database test;删除test数据库17.show databases;查看库,确认八.删除测试用过的用户1.应用root登录mysql数据库2.revoke all privileges on *.* from centospub@localhost; 取消centospub用户对数据库的操作权限3.delete from mysql.user where user="centospub" and host="localhost";删除4.select user from mysql.user;查看,确认5.flush privileges;刷新,使生效九.重新启动http服务/etc/rc.d/init.d/httpd restartLinux下phpMyAdmin安装过程中的问题解决Ubuntu下管理Oracle官方软件sqldeveloper最方便安装相关资讯 mysql CentOS
- 数据库服务器 MySQL (08/15/2013 06:50:23)
- CentOS /usr/libexec/gconf-sanity (07/04/2013 17:07:42)
- 为什么我们选择CentOS而不是Debian (06/06/2013 06:19:40)
| - CentOS虚拟机NAT静态IP设置 (07/04/2013 17:09:32)
- CentOS 格式化新硬盘并设置开机自 (07/04/2013 16:50:50)
- MySQL Administrator连接VMWare下 (05/24/2013 09:20:58)
|
本文评论 查看全部评论 (0)