<img src="https://bucketblog.oss-cn-shenzhen.aliyuncs.com/blog/pic/mysql_logo.jpg" width="250" hegiht="150"/>mysql
yum -y install mysql-server
rpm -qa|grep mysql-server
default-character-set = utf8
character-set-server=utf8
sudo vim /etc/my.conf
default-character-set = utf8 character-set-server = utf8
chkconfig mysqld on
chkconfig --list mysqld
sudo vim /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
sudo service iptables restart
sudo service mysqld start
或者sql
/etc/rc.d/init.d/mysqld start
由于 mysql 还未设置密码,因此须要设置登陆数据库服务器的密码。shell
mysql -u root
select user,host from mysql.user;
delete from mysql.user where user='';
select user,host from mysql.user;
insert into mysql.user(Host, User, Password) values("localhost", "huaiangg", Password("123456"));
create database `mmall` default character set utf8 collate utf8_general_ci;
select * from mysql.user \G;
-- on 后面接的是 数据库名.表名 .*表示该数据库下的全部表 -- root@localhost 表示用户名@ip地址 -- identitified by '123456' ''里面表示该帐户的密码 -- with grant option 表示能够把本身的权限赋值给别的用户 grant all privileges on mmall.* to root@'%' identified by '123456' with grant option;
-- root@localhost ->> 用户名@ip -- Password() ->> 内置函数 set password for root@localhost=Password('123456');
mysql -u root -p
ifconfig
select user,host,password from mysql.user;
set password for root@localhost=password('your new password');
或者数据库
set password for root@127.0.0.1=password('your new password');
exit
mysql -u root -p
select user,host from mysql.user;
delect from mysql.user where user = '';
flush privileges;
insert into mysql.user(Host,User,Password) values("localhost", "yourusername", password("yourpaddword"));
flush privileges;
CREATE DATABASE `db_test` DEFAULT CHARRACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on db_test.* to yourusername@localhost identified by 'yourpassword';
grant all privileges on db_test.* to 'yourusername'@'%' identified by 'yourpassword';
grant select,insert,update on db_test.* to yourusername@'192.168.199.111' identified by 'yourpassword';
人若无名,专心练剑! 喜欢的朋友能够留下你的赞!vim