一、yum安装mysql
1、查看有没有安装过:
yum list installed mysql* rpm -qa | grep mysql*
2、查看有没有安装包:
yum list mysql*
3、安装mysql客户端:
yum install mysql
4、安装mysql 服务器端:
yum install mysql-server yum install mysql-devel
二、mysql加入开机启动
1、数据库字符集设置
mysql配置文件/etc/my.cnf中mysqld加入(5.5版本以后)
character-set-server=utf8
2、启动mysql服务:
service mysqld start或者/etc/init.d/mysqld start
3、开机启动:
chkconfig add mysqld chkconfig mysqld on
4、查看开机启动设置是否成功
[root@sql ~]# chkconfig --list | grep mysql* mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
三、创建管理员、密码等
1、创建root管理员:
mysqladmin -u root password 123456
2、登录:
mysql -u root -p输入密码即可
3、忘记密码:
service mysqld stop mysqld_safe --user=root --skip-grant-tables mysql -u root use mysql update user set password=password("new_pass") where user="root"; flush privileges;
四、远程访问:
五、创建用户,授权数据库
Copyright:www.cplusplus.me Share、Open- C/C++程序员之家