时间:2021-07-01 10:21:17 帮助过:17人阅读
修改配置
[root@git /]# vim /etc/my.cnf [mysqld] #skip-grant-tables secure_file_priv="/usr/local/mysql" port = 3306 basedir = /usr/local/mysql datadir = /usr/local/mysql/data socket=/tmp/mysql.sock pid-file=/usr/local/mysql/data/mysql.pid log-error=/usr/local/mysql/data/error.log character_set_server=utf8 user=mysql max_connections=1500 symbolic-links=0 !includedir /etc/my.cnf.d
启动
[root@git mysql-5.7.23-el7-x86_64]# pwd /mysql-5.7.23-el7-x86_64 [root@git mysql-5.7.23-el7-x86_64]# ls bin COPYING docs include lib man README share support-files [root@git mysql-5.7.23-el7-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld [root@git mysql-5.7.23-el7-x86_64]# cp -r bin/ /usr/local/mysql/ [root@git mysql-5.7.23-el7-x86_64]# chown -R mysql:mysql /usr/local/mysql/ [root@git mysql-5.7.23-el7-x86_64]# cd / [root@git /]# /etc/init.d/mysqld restart Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!
修改密码
[root@git /]# cd /usr/local/mysql/bin/ [root@git bin]# ls innochecksum my_print_defaults mysql_config mysqldump mysqlpump mysql_tzinfo_to_sql resolve_stack_dump lz4_decompress mysql mysql_config_editor mysqldumpslow mysql_secure_installation mysql_upgrade zlib_decompress myisamchk mysqladmin mysqld mysql_embedded mysqlshow mysqlxtest myisam_ftdump mysqlbinlog mysqld-debug mysqlimport mysqlslap perror myisamlog mysqlcheck mysqld_multi mysql_install_db mysql_ssl_rsa_setup replace myisampack mysql_client_test_embedded mysqld_safe mysql_plugin mysqltest_embedded resolveip [root@git bin]# ./mysql -uroot -p Enter password:
密码忘记修改
1.
2.修改MySQL的登录设置: # vim /etc/my.cnf 在[mysqld]的段中加上一句:skip-grant-tables 例如: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables 保存并且退出vi。 3.重新启动mysqld # service mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ] 4.登录并修改MySQL的root密码 # mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 3.23.56 Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the buffer. mysql> USE mysql ; Database changed mysql> UPDATE user SET Password = password ( ‘new-password‘ ) WHERE User = ‘root‘ ; Query OK, 0 rows affected (0.00 sec) Rows matched: 2 Changed: 0 Warnings: 0 mysql> flush privileges ; Query OK, 0 rows affected (0.01 sec) mysql> quit
2.
set password for root@localhost = password(‘123456‘);
如果报错需要先执行
flush privileges;
mysql 全目录可执行
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
如果换用户无法访问,检查有无访问链接路径的权限
mysql-5.7.23-el7-x86_64.tar安装配置
标签:依赖 权限 str sqlt connect his cannot fill blank