首页 > 代码库 > Fedora mysql搭建

Fedora mysql搭建

yum install mysql
yum install mysql-server
yum install mysql-devel
chgrp -R mysql /var/lib/mysql
chmod -R 770 /var/lib/mysql

service mysqld start


修改root的密码 

mysqladmin -u root password ‘newpassword‘ 更改密码 

mysql -u root -p   登录数据库 

 mysql> DROP DATABASE test;   删除test数据库 

mysql> DELETE FROM mysql.user WHERE user = ‘‘; 删除匿名帐户 

mysql> FLUSH PRIVILEGES;   重载权限 

添加mysql用户:GRANT ALL PRIVILEGES ON my_db.* TO ‘user‘@‘localhost‘ IDENTIFIED BY ‘password‘;

# sudo service mysqld restart  重启服务

# sudo service mysqld stop  关闭服务

 /etc/rc.d/init.d/mysqld status   查看mysql状态

# sudo chkconfig --del mysqld  删除服务清单中mysql服务

 chkconfig --list    察看mysql是否在自动启动列表中

#sudo /etc/init.d/mysqld start   启动mysql服务

#sudo /etc/init.d/mysqld stop   关闭mysql服务

#sudo /etc/init.d/mysqld restart   重启mysql服务