linux系统下mysql安装过程中遇到的问题与解决方法

时间:2022-11-22 16:37:08
问题ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解决方法:修改/etc/my.cnf   
  socket = /var/lib/mysql/mysql.sock? #添加该行
问题Starting MySQL... ERROR! The server quit without updating PID file (/data/mysql/server-2.novalocal.pid).
解决方法:键入以下内容
(1)/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/
(2)权限问题:/data/mysql   /var/lib/mysql    /usr/local/mysql
(3)进程卡死:使用ps -ef |grep mysql* 查看mysql进程如果有就kill
问题ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: NO)
解决方法1、先停止mysql:/etc/init.d/mysql stop
        2、输入:/etc/init.d/mysql stop ? (service mysqld stop )
/usr/bin/mysqld_safe --skip-grant-tables
另外开个SSH连接
[root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password("123456") where user="root";
mysql>flush privileges;
mysql>exit
然后
[mysql@localhost etc]$ ps -A | grep mysql
4532 pts/0 ? ?00:00:00 mysqld_safe
5542 pts/0 ? ?00:00:00 mysqld
[mysql@localhost etc]$ kill -9 4532 5542?
正常启动 MySQL:/etc/init.d/mysql start ? (service mysqld start)


第三步:
登陆ok。 mysql -uroot -p
进入mysql后可能还需要使用set password=password(“123456”);重新设置密码才能正常使用
问题CMake Error at cmake/readline.cmake:64 (MESSAGE):
  Curses library not found.  Please install appropriate package,
解决方法:rm -f CMakeCache.txt

删除刚才编译生成的 CMakeCache.txt 文件
安装 ncurses-devel 包
yum install ncurses-devel
问题:ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
解决:/usr/local/mysql/bin/mysqladmin -uroot -p password

问题:-bash: ./mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

缺少安装组件,perl和perl-devel

yum安装即可

yum -y install perl perl-devel