记一次mysql连接错误
mysql_real_connect连接失败
printf("%s\n", mysql_error(&c)); //Access denied for user 'root'@'localhost'
printf("%d", mysql_errno(&c)); //1698
cat /etc/mysql/debian.cnf 先用初始密码登录
USE mysql
select user,plugin from  user
发现root的plugin是auth_socket
运行:
update user set authentication_string =password('你的密码'),plugin='msyql_native_password' where user='root';
sudo service mysql stop
sudo service mysql start
解决。

                
            
        
浙公网安备 33010602011771号