以root身份拷贝了一个.py文件到/use/bin/python.导致mac自带的python2.7不能用了,运行不了python程序。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了以root身份拷贝了一个.py文件到/use/bin/python.导致mac自带的python2.7不能用了,运行不了python程序。相关的知识,希望对你有一定的参考价值。

各种搞不定,特来百度求大神帮忙,只要不重装就行。

参考技术A /use/bin/python不是文件夹而是python的执行文件。
你实际上是把.py文件重命名为python文件。导致python主程序被替换。
python当然就不能运行了。
这样的情况下,只能重装python。
或者到别的mac机上复制一个/usr/bin/python文件到你的机上。
参考技术B 新拷贝的py文件名字不对,占用了关键字。重新改个个性的名字。

没有密码就无法以root身份登录phpmyadmin [关闭]

【中文标题】没有密码就无法以root身份登录phpmyadmin [关闭]【英文标题】:Cant login as root with no password to phpmyadmin [closed] 【发布时间】:2011-12-07 22:41:00 【问题描述】:

这是我的 config.inc.php 文件,因为我突然升级到 11.10,我无法在没有密码的情况下以 root 身份登录。我已经正确设置了指令,所以这对于它为什么不再允许这样做是相当令人困惑的。有什么帮助吗?

$i = 0;
$i++;

if (is_readable('/etc/phpmyadmin/config-db.php')) 
    require('/etc/phpmyadmin/config-db.php');
 else 
    error_log('phpmyadmin: Failed to load /etc/phpmyadmin/config-db.php.'
        . ' Check group www-data has read access.');


/* Configure according to dbconfig-common if enabled */
if (!empty($dbname)) 
    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    /* Server parameters */
    if (empty($dbserver)) $dbserver = 'localhost';
    $cfg['Servers'][$i]['host'] = $dbserver;

    if (!empty($dbport) || $dbserver != 'localhost') 
        $cfg['Servers'][$i]['connect_type'] = 'tcp';
        $cfg['Servers'][$i]['port'] = $dbport;
    
    //$cfg['Servers'][$i]['compress'] = false;
    /* Select mysqli if your server has it */
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    /* Optional: User for advanced features */
    $cfg['Servers'][$i]['controluser'] = $dbuser;
    $cfg['Servers'][$i]['controlpass'] = $dbpass;
    /* Optional: Advanced phpMyAdmin features */
    $cfg['Servers'][$i]['pmadb'] = $dbname;
    $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma_relation';
    $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
    $cfg['Servers'][$i]['history'] = 'pma_history';
    $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
    $cfg['Servers'][$i]['tracking'] = 'pma_tracking';

    /* Uncomment the following to enable logging in to passwordless accounts,
     * after taking note of the associated security risks. */
    $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

    /* Advance to next server for rest of config */
    $i++;


/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
//$cfg['Servers'][$i]['extension'] = 'mysql';
/* Optional: User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Optional: Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/*
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

【问题讨论】:

我有 phpMyAdmin 11.10,我可以使用 root 登录,无需密码。看起来它是针对您的。 是的,令人困惑,但正如您所见,在底部“AllowNoPassword”TRUE 附近有第二条注释行……所以我也取消了注释。现在我是 gtg。 【参考方案1】:

底部附近还有第二行:

/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

这一行也需要取消注释。

【讨论】:

以上是关于以root身份拷贝了一个.py文件到/use/bin/python.导致mac自带的python2.7不能用了,运行不了python程序。的主要内容,如果未能解决你的问题,请参考以下文章

linux中切换用户 “aa” 时不能切换 !

/usr/bin/env: python: 权限不够 root@kali:~# 这个是怎么回事? 我执行PY文件就会这样,

以root身份运行python脚本

以root身份在脚本中间运行命令[重复]

Linux安装vmtools

如何使用 Aquamacs 以 root 身份打开文件进行编辑?