1. 准备好配置文件 my.cnfmysql
2.创建my.cnf中用到的必要的目录sql
3.在mysql目录下有个scripts/mysql_install_db, 执行:socket
scripts/mysql_install_db --defaults-file=/opt/etc/my.cnf --user=mysqlip
4.启动服务配置
/opt/mysql/bin/mysqld_safe --defaults-file=/opt/mysql/etc/my.cnf &file
5. 修改密码密码
/opt/mysql/bin/mysqladmin -u root password '123456' --socket=/opt/data/mysqld.sock配置文件
/opt/mysql/bin/mysqladmin -u root -h your_host_name password '123456' --socket=/opt/data/mysqld.sockdb
6.登录验证word
bin/mysql -uroot --socket=/opt/data/mysqld.sock