Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Monday, December 8, 2014

ORACLE - ORA-01031: insufficient privileges


[root@cacti ~]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:04:53 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01031: insufficient privileges


SQL> connect siltech/siltech
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0



SQL> exit
[root@cacti ~]# less .bash_profile 
[root@cacti ~]# su - oracle
-bash-4.1$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
-bash-4.1$ export ORACLE_SID=xe
-bash-4.1$ export PATH=$PATH:$ORACLE_HOME/bin
-bash-4.1$ export ORACLE_BASE=/u01/app/oracle; 
-bash-4.1$ export ORACLE_TER=Mxterm; 
-bash-4.1$ export PATH=/usr/sbin:$PATH; 
-bash-4.1$ export PATH=$ORACLE_HOME/bin:$PATH; 
-bash-4.1$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; 
-bash-4.1$ export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; 
-bash-4.1$ 
-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:07:37 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01031: insufficient privileges


SQL> exit
-bash-4.1$
-bash-4.1$ pwd
/u01/app/oracle
-bash-4.1$ ll
total 24
drwxr-x---. 4 oracle dba  4096 Nov 11 11:42 admin
-rw-r--r--  1 oracle dba     0 Dec  8 10:05 connect
drwxrwxr-x. 4 oracle dba  4096 Nov 26 08:06 diag
-rw-r--r--  1 oracle dba     0 Dec  8 10:06 exit
drwxr-x---. 3 oracle dba  4096 Nov 11 11:42 fast_recovery_area
drwxr-x---. 3 oracle dba  4096 Nov 11 11:42 oradata
drwxr-xr-x. 3 oracle dba  4096 Nov 11 11:42 oradiag_oracle
drwxr-xr-x. 3 root   root 4096 Nov 11 11:40 product
-bash-4.1$ 
[root@cacti /]# chown oracle:dba -R /u01/
[root@cacti oracle]# ll
total 24
drwxr-x---. 4 oracle dba 4096 Nov 11 11:42 admin
-rw-r--r--  1 oracle dba    0 Dez  8 10:05 connect
drwxrwxr-x. 4 oracle dba 4096 Nov 26 08:06 diag
-rw-r--r--  1 oracle dba    0 Dez  8 10:06 exit
drwxr-x---. 3 oracle dba 4096 Nov 11 11:42 fast_recovery_area
drwxr-x---. 3 oracle dba 4096 Nov 11 11:42 oradata
drwxr-xr-x. 3 oracle dba 4096 Nov 11 11:42 oradiag_oracle
drwxr-xr-x. 3 oracle dba 4096 Nov 11 11:40 product

[root@cacti ~]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:13:13 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-12547: TNS:lost contact


SQL>exit
[root@cacti bin]# su - oracle
-bash-4.1$ cd /u01/app/oracle/product/11.2.0/xe/bin/
-bash-4.1$ ./sqlplus 
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
-bash-4.1$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe/
-bash-4.1$ ./sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:24:13 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter user-name: system
Enter password: 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
-bash-4.1$ export ORACLE_SID=XE
-bash-4.1$ ./sqlplus 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01017: invalid username/password; logon denied

-bash-4.1$ ll
total 20
-rw-rw----. 1 oracle dba 1544 Nov 11 11:43 hc_XE.dat
-rwxr-xr-x. 1 oracle dba 2851 Aug 29  2011 init.ora
-rw-r-----. 1 oracle dba   24 Nov 11 11:42 lkXE
-rw-r-----. 1 oracle dba 1536 Nov 11 11:43 orapwXE
-rw-r-----  1 oracle dba 2560 Dec  4 10:48 spfileXE.ora
-bash-4.1$ pwd
/u01/app/oracle/product/11.2.0/xe/dbs
-bash-4.1$ orapwd 
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

  where
    file - name of password file (required),
    password - password for SYS will be prompted if not specified at command line,
    entries - maximum number of distinct DBA (optional),
    force - whether to overwrite existing file (optional),
    ignorecase - passwords are case-insensitive (optional),
    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
    
  There must be no spaces around the equal-to (=) character.
-bash-4.1$ orapwd file=orapwXE password=123456

OPW-00005: File with same name exists - please delete or rename
-bash-4.1$ rm -rf orapwXE 
-bash-4.1$ orapwd file=orapwXE password=123456
-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:50:50 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


SQL> connect sys as sysdba
Enter password: 
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  784998400 bytes
Fixed Size     2230608 bytes
Variable Size   583009968 bytes
Database Buffers   197132288 bytes
Redo Buffers     2625536 bytes
Database mounted.
Database opened.
SQL> 










Monday, August 11, 2014

MAC OSX 10.9 / Django + Python MYSQL SERVER ERROS/RESOLVIDOS

ERROS: 

Error loading MySQLdb module: No module named MySQLdb
EnvironmentError: mysql_config not found
error: command 'cc' failed with exit status 1
Library not loaded: libmysqlclient.18.dylib
django.db.utils.OperationalError: (1049, "Unknown database 'cursodjango'")
CommandError: No database fixture specified. Please provide the path of at least one fixture in the command line.

 raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

1˚ Tentei instalar o adaptador para MySQL-Python ...

(django-1.4)macbookdeandre:venvs alds$ pip install MySQL-Python
Downloading/unpacking MySQL-Python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/Volumes/STORAGE/Projects_Web/venvs/django-1.4/build/MySQL-Python/setup.py) egg_info for package MySQL-Python
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/build/MySQL-Python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/build/MySQL-Python/setup.py", line 17, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Volumes/STORAGE/Projects_Web/venvs/django-1.4/build/MySQL-Python


Storing debug log for failure in /Users/alds/.pip/pip.log

2˚ Instalei o MySQL Server no MAC OXS  + Adicionei os binarios  MySQL no PATH 

macbookdeandre:cursodjango alds$ ls /usr/local/mysql/bin/
innochecksum               mysql                      mysql_find_rows            mysql_waitpid              mysqlcheck                 mysqlhotcopy               replace
msql2mysql                 mysql_client_test          mysql_fix_extensions       mysql_zap                  mysqld                     mysqlimport                resolve_stack_dump
my_print_defaults          mysql_client_test_embedded mysql_plugin               mysqlaccess                mysqld-debug               mysqlshow                  resolveip
myisam_ftdump              mysql_config               mysql_secure_installation  mysqlaccess.conf           mysqld_multi               mysqlslap
myisamchk                  mysql_config_editor        mysql_setpermission        mysqladmin                 mysqld_safe                mysqltest
myisamlog                  mysql_convert_table_format mysql_tzinfo_to_sql        mysqlbinlog                mysqldump                  mysqltest_embedded
myisampack                 mysql_embedded             mysql_upgrade              mysqlbug                   mysqldumpslow              perror
macbookdeandre:cursodjango alds$ cd 
macbookdeandre:~ alds$ vim .bash_profile 
PATH=$PATH:/usr/local/mysql/bin


3˚ Tentei instalar o adaptador já MySQL Server estava instalado, porem tive erro porque o XCODE não estava instalado.

macbookdeandre:Projects_Web alds$ ls
sites venvs
macbookdeandre:Projects_Web alds$ source venvs/django-1.4/bin/activate
(django-1.4)macbookdeandre:Projects_Web alds$  pip install MySQL-Python
Downloading/unpacking MySQL-Python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
....
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

error: command 'cc' failed with exit status 1

4˚ Depois de instalar o XCODE , alguns binários o vem no conjunto com o CC, necessário para compilação de alguns pacotes.

macbookdeandre:Projects_Web alds$ c
Display all 117 possibilities? (y or n)
c++                 cancel              chflags             cmp                 complete            cpan2dist           cpp                 csplit              cupsreject          cvfsdb
c++filt             cap_mkdb            chfn                cmpdylib            compress            cpan2dist5.12       cpu_profiler.d      csreq               cupstestdsc         cvfsid
c2ph                captoinfo           chgrp               codesign            config_data         cpan2dist5.16       cpuwalk.d           ctags               cupstestppd         cvgather
c2ph5.12            case                chmod               codesign_allocate   config_data5.12     cpan5.12            crc32               ctf_insert          curl                cvlabel
c2ph5.16            cat                 chown               col                 config_data5.16     cpan5.16            crc325.12           cu                  curl-config         cvmkdir
c89                 cc                  chpass              colcrt              continue            cpanp               crc325.16           cups-config         cut                 cvmkfile
c99                 cd                  chroot              colldef             coreaudiod          cpanp-run-perl      creatbyproc.d       cupsaccept          cvadmin             cvmkfs
c_rehash            certtool            chsh                colrm               corelist            cpanp-run-perl5.12  createhomedir       cupsaddsmb          cvaffinity          cvupdatefs
caffeinate          cfprefsd            cksum               column              corelist5.12        cpanp-run-perl5.16  crlrefresh          cupsctl             cvcp                cvversions
cal                 chat                clang               comm                corelist5.16        cpanp5.12           cron                cupsdisable         cvdb                
calendar            checkgid            clang++             command             cp                  cpanp5.16           crontab             cupsenable          cvdbset             
caller              checknr             clear               compgen             cpan                cpio                csh                 cupsfilter          cvfsck         

5˚ Instalacão do Pacote MySQL-Python realizada com sucesso. 

macbookdeandre:Projects_Web alds$ ls
sites venvs
macbookdeandre:Projects_Web alds$ source venvs/django-1.4/bin/activate
(django-1.4)macbookdeandre:Projects_Web alds$ pip install MySQL-Python
Downloading/unpacking MySQL-Python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/Volumes/STORAGE/Projects_Web/venvs/django-1.4/build/MySQL-Python/setup.py) egg_info for package MySQL-Python
    
Installing collected packages: MySQL-Python
  Running setup.py install for MySQL-Python
    building '_mysql' extension
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
    In file included from _mysql.c:44:
    /usr/local/mysql/include/my_config.h:348:11: warning: 'SIZEOF_SIZE_T' macro redefined
      #define SIZEOF_SIZE_T  SIZEOF_LONG
              ^
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
    #        define SIZEOF_SIZE_T           8
                    ^
    In file included from _mysql.c:44:
    /usr/local/mysql/include/my_config.h:442:9: warning: 'HAVE_WCSCOLL' macro redefined
    #define HAVE_WCSCOLL
            ^
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:906:9: note: previous definition is here
    #define HAVE_WCSCOLL 1
            ^
    _mysql.c:287:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                    cmd_argc = PySequence_Size(cmd_args);
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:317:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                    groupc = PySequence_Size(groups);
                           ~ ^~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:470:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                            int j, n2=PySequence_Size(fun);
                                   ~~ ^~~~~~~~~~~~~~~~~~~~
    _mysql.c:1127:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_real_escape_string(&(self->connection), out, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1129:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_escape_string(out, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1168:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
            size = PyString_GET_SIZE(s);
                 ~ ^~~~~~~~~~~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
    #define PyString_GET_SIZE(op)  Py_SIZE(op)
                                   ^~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
    #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    _mysql.c:1178:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_real_escape_string(&(self->connection), out+1, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1180:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                    len = mysql_escape_string(out+1, in, size);
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _mysql.c:1274:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
            if ((n = PyObject_Length(o)) == -1) goto error;
                   ~ ^~~~~~~~~~~~~~~~~~
    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
    #define PyObject_Length PyObject_Size
                            ^
    _mysql.c:1466:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                            len = strlen(buf);
                                ~ ^~~~~~~~~~~
    _mysql.c:1468:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                            len = strlen(buf);
                                ~ ^~~~~~~~~~~
    _mysql.c:1504:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                    len = strlen(buf);
                                        ~ ^~~~~~~~~~~
    _mysql.c:1506:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                                    len = strlen(buf);
                                        ~ ^~~~~~~~~~~
    _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (how < 0 || how >= sizeof(row_converters)) {
                ~~~ ^ ~
    16 warnings generated.
    cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.9-intel-2.7/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -o build/lib.macosx-10.9-intel-2.7/_mysql.so -arch x86_64
    
Successfully installed MySQL-Python
Cleaning up...
(django-1.4)macbookdeandre:Projects_Web alds$ 


6˚ Problema com : Library not loaded: libmysqlclient.18.dylib

(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py validate
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
    translation.activate('en-us')
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
    return _trans.activate(language)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
    _active.value = translation(language)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 6, in <module>
    from django.contrib.admin.sites import AdminSite, site
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 4, in <module>
    from django.contrib.admin.forms import AdminAuthenticationForm
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/contrib/admin/forms.py", line 6, in <module>
    from django.contrib.auth.forms import AuthenticationForm
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 17, in <module>
    from django.contrib.auth.models import User
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/contrib/auth/models.py", line 48, in <module>
    class Permission(models.Model):
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/models/base.py", line 96, in __new__
    new_class.add_to_class('_meta', Options(meta, **kwargs))
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class
    value.contribute_to_class(cls, name)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/models/options.py", line 124, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/utils.py", line 198, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/utils.py", line 113, in load_backend
    return import_module('%s.base' % backend_name)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/_mysql.so
  Reason: image not found
(django-1.4)macbookdeandre:cursodjango alds$ ll /usr/local/mysql/lib/libmysqlclient.18.dylib
-rwxr-xr-x  1 root  wheel   4,1M 18 Jul 13:10 /usr/local/mysql/lib/libmysqlclient.18.dylib
(django-1.4)macbookdeandre:cursodjango alds$  ll /usr/lib/libmysqlclient.18.dylib
ls: /usr/lib/libmysqlclient.18.dylib: No such file or directory
(django-1.4)macbookdeandre:cursodjango alds$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
Password:
(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py validate
0 errors found
(django-1.4)macbookdeandre:cursodjango alds$ 

7˚ Novo problema com o banco : django.db.utils.OperationalError: (1049, "Unknown database 'cursodjango'")


(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py testserver
Creating test database for alias 'default'...
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/core/management/commands/testserver.py", line 29, in handle
    db_name = connection.creation.create_test_db(verbosity=verbosity, autoclobber=not interactive)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/creation.py", line 326, in create_test_db
    self._create_test_db(verbosity, autoclobber)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/creation.py", line 387, in _create_test_db
    cursor = self.connection.cursor()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/__init__.py", line 160, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/__init__.py", line 132, in _cursor
    self.ensure_connection()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/__init__.py", line 115, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 435, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/Volumes/STORAGE/Projects_Web/venvs/django-1.4/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1049, "Unknown database 'cursodjango'")

8˚ Criar database para ver se resolver o problema 

macbookdeandre:cursodjango alds$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2577
Server version: 5.6.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0,00 sec)

mysql> create database cursodjango
    -> ;
Query OK, 1 row affected (0,00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cursodjango        |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0,00 sec)

mysql> 

9˚ Novo teste SERVER

(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py testserver
Creating test database for alias 'default'...
CommandError: No database fixture specified. Please provide the path of at least one fixture in the command line.
(django-1.4)macbookdeandre:cursodjango alds$
(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py syncdb
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table aula5_contato

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'alds'): yes
Email address: andre.luiz.silva.als@gmail.com
Password: 
Password (again): 
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
(django-1.4)macbookdeandre:cursodjango alds$ 

(django-1.4)macbookdeandre:cursodjango alds$ ./manage.py sqlall aula5
BEGIN;
CREATE TABLE `aula5_contato` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `nome` varchar(100) NOT NULL,
    `email` varchar(75) NOT NULL,
    `site` varchar(200) NOT NULL,
    `data_nascimento` date NOT NULL
)
;

COMMIT;