Use yum to install mysql under linux, as well as start, login and remote access.
1. Installation
Check if it is installed:
yum list installed mysql*
rpm -qa | grep mysql*
Check if the package is installed:
yum list mysql*
Install the mysql client:
yum install mysql
Install mysql server side:
yum install mysql-server
yum install mysql-devel
2. Start && Stop
Database character set settings
Add default-character-set=utf8 to the mysql configuration file /etc/my.cnf
Start the mysql service:
service mysqld start or /etc/init.d/mysqld start
boot:
chkconfig -add mysqld, check whether the startup settings are successful chkconfig --list | grep mysql*
mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off
stop:
service mysqld stop
3. Login
Create root administrator:
mysqladmin -u root password 123456
Log in:
mysql -u root -p Enter the password.
Forgot password:
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;
4、远程访问
开放防火墙的端口号
mysql增加权限:mysql库中的user表新增一条记录host为“%”,user为“root”。
5、Linux MySQL的几个重要目录
数据库目录
/var/lib/mysql/
配置文件
/usr/share /mysql(mysql.server命令及配置文件)
相关命令
/usr/bin(mysqladmin mysqldump等命令)
启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)